Fix throw on repeated filename (#124)

Co-authored-by: Giovanni Baraldi <gbaraldi@amd.com>
Cette révision appartient à :
Baraldi, Giovanni
2025-01-21 02:24:28 +01:00
révisé par GitHub
Parent 95b3fead0e
révision 081419b745
+10 -1
Voir le fichier
@@ -155,7 +155,16 @@ CodeFile::~CodeFile()
std::vector<std::string> path_elements(filepath.begin(), filepath.end());
navigate(jsnapfiletree, path_elements, newfile.str());
rocprofiler::common::filesystem::copy(filepath, dir / newfile.str());
constexpr auto opt = rocprofiler::common::filesystem::copy_options::overwrite_existing;
try
{
rocprofiler::common::filesystem::copy(filepath, dir / newfile.str(), opt);
} catch(std::exception& e)
{
ROCP_WARNING << "Missing source file " << filepath << ": " << e.what();
ROCP_CI_LOG(ERROR) << "Unable to copy source files: " << (dir / newfile.str());
}
}
}