Fix throw on repeated filename (#124)

Co-authored-by: Giovanni Baraldi <gbaraldi@amd.com>

[ROCm/rocprofiler-sdk commit: 081419b745]
This commit is contained in:
Baraldi, Giovanni
2025-01-21 02:24:28 +01:00
committed by GitHub
parent 5ed4a1e320
commit 3b4b9013ed
@@ -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());
}
}
}