diff options
author | Brad King <brad.king@kitware.com> | 2023-12-05 14:23:31 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2023-12-05 14:23:49 (GMT) |
commit | d101cb07ec732b3b9cdd29bda643ffae3f1e7d92 (patch) | |
tree | 569b7cdd68342465b07f3224b989b51c7a10736b /Source/cmFileCommand.cxx | |
parent | 4139486a4ff5783f04f320f3aaad182833ad275f (diff) | |
parent | a820877d033069062f2cac83d9e611d5af905d0a (diff) | |
download | CMake-d101cb07ec732b3b9cdd29bda643ffae3f1e7d92.zip CMake-d101cb07ec732b3b9cdd29bda643ffae3f1e7d92.tar.gz CMake-d101cb07ec732b3b9cdd29bda643ffae3f1e7d92.tar.bz2 |
Merge topic 'cmFileCopier-error-loss'
a820877d03 errors: avoid constructing a stream before getting the last error
5cf7018af6 cmFileCopier: remember error statuses and get their strings
0639a32d3a cmFileTimes: return status codes from APIs
Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !9023
Diffstat (limited to 'Source/cmFileCommand.cxx')
-rw-r--r-- | Source/cmFileCommand.cxx | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx index 9cd3db1..c1b7b48 100644 --- a/Source/cmFileCommand.cxx +++ b/Source/cmFileCommand.cxx @@ -3024,16 +3024,15 @@ bool HandleCreateLinkCommand(std::vector<std::string> const& args, // Check if the new file already exists and remove it. if (cmSystemTools::PathExists(newFileName) && !cmSystemTools::RemoveFile(newFileName)) { - std::ostringstream e; - e << "Failed to create link '" << newFileName - << "' because existing path cannot be removed: " - << cmSystemTools::GetLastSystemError() << "\n"; + auto err = cmStrCat("Failed to create link '", newFileName, + "' because existing path cannot be removed: ", + cmSystemTools::GetLastSystemError(), '\n'); if (!arguments.Result.empty()) { - status.GetMakefile().AddDefinition(arguments.Result, e.str()); + status.GetMakefile().AddDefinition(arguments.Result, err); return true; } - status.SetError(e.str()); + status.SetError(err); return false; } |