Skip to content

Commit 56be80c

Browse files
author
Baraldi, Giovanni
authored
Fix throw on repeated filename (#124)
Co-authored-by: Giovanni Baraldi <gbaraldi@amd.com> [ROCm/rocprofiler-sdk commit: 081419b]
1 parent 60145ed commit 56be80c

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

source/lib/rocprofiler-sdk-att/code.cpp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,16 @@ CodeFile::~CodeFile()
155155

156156
std::vector<std::string> path_elements(filepath.begin(), filepath.end());
157157
navigate(jsnapfiletree, path_elements, newfile.str());
158-
rocprofiler::common::filesystem::copy(filepath, dir / newfile.str());
158+
159+
constexpr auto opt = rocprofiler::common::filesystem::copy_options::overwrite_existing;
160+
try
161+
{
162+
rocprofiler::common::filesystem::copy(filepath, dir / newfile.str(), opt);
163+
} catch(std::exception& e)
164+
{
165+
ROCP_WARNING << "Missing source file " << filepath << ": " << e.what();
166+
ROCP_CI_LOG(ERROR) << "Unable to copy source files: " << (dir / newfile.str());
167+
}
159168
}
160169
}
161170

0 commit comments

Comments
 (0)