diff options
author | Brad King <brad.king@kitware.com> | 2022-11-15 00:32:07 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2022-11-15 14:28:45 (GMT) |
commit | 89b144789d969e4af06de515df2595b9a043431f (patch) | |
tree | 14a9e904ec39d1fc2602341df27c8044bc090b82 /Source | |
parent | 91dd7898ee6f6e38e55430bbb55fd5db851671e9 (diff) | |
download | CMake-89b144789d969e4af06de515df2595b9a043431f.zip CMake-89b144789d969e4af06de515df2595b9a043431f.tar.gz CMake-89b144789d969e4af06de515df2595b9a043431f.tar.bz2 |
file(COPY_FILE): Report if failure occurred on input or output path
When we know whether a failure was associated with the input or the
output path, include this information in the error message.
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmSystemTools.cxx | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index ee74908..78d230e 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -1140,7 +1140,7 @@ cmSystemTools::CopyResult cmSystemTools::CopySingleFile( return CopyResult::Success; } - cmsys::Status status; + cmsys::SystemTools::CopyStatus status; status = cmsys::SystemTools::CloneFileContent(oldname, newname); if (!status) { // if cloning did not succeed, fall back to blockwise copy @@ -1149,14 +1149,24 @@ cmSystemTools::CopyResult cmSystemTools::CopySingleFile( if (!status) { if (err) { *err = status.GetString(); + switch (status.Path) { + case cmsys::SystemTools::CopyStatus::SourcePath: + *err = cmStrCat(*err, " (input)"); + break; + case cmsys::SystemTools::CopyStatus::DestPath: + *err = cmStrCat(*err, " (output)"); + break; + default: + break; + } } return CopyResult::Failure; } if (perms) { - status = SystemTools::SetPermissions(newname, perm); - if (!status) { + perms = SystemTools::SetPermissions(newname, perm); + if (!perms) { if (err) { - *err = status.GetString(); + *err = cmStrCat(perms.GetString(), " (output)"); } return CopyResult::Failure; } |