summaryrefslogtreecommitdiffstats
path: root/Source/cmcmd.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2022-10-06 17:44:27 (GMT)
committerBrad King <brad.king@kitware.com>2022-10-06 18:38:53 (GMT)
commitaba48bd6acbf564dcb5b831b26cc01743b5b5f71 (patch)
tree9b0d1e44f351ee52509095fb801509e630f5814f /Source/cmcmd.cxx
parent2133cf2c8e575bfff000041505208e28bcdfd4a3 (diff)
downloadCMake-aba48bd6acbf564dcb5b831b26cc01743b5b5f71.zip
CMake-aba48bd6acbf564dcb5b831b26cc01743b5b5f71.tar.gz
CMake-aba48bd6acbf564dcb5b831b26cc01743b5b5f71.tar.bz2
cmSystemTools: Provide quiet link creation methods
Offer variants that let the caller handle error messages.
Diffstat (limited to 'Source/cmcmd.cxx')
-rw-r--r--Source/cmcmd.cxx7
1 files changed, 3 insertions, 4 deletions
diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx
index 00c9bda..16944e6 100644
--- a/Source/cmcmd.cxx
+++ b/Source/cmcmd.cxx
@@ -1700,16 +1700,15 @@ cmsys::Status cmcmd::SymlinkInternal(std::string const& file,
}
std::string linktext = cmSystemTools::GetFilenameName(file);
#if defined(_WIN32) && !defined(__CYGWIN__)
- std::string errorMessage;
- cmsys::Status status =
- cmSystemTools::CreateSymlink(linktext, link, &errorMessage);
+ cmsys::Status status = cmSystemTools::CreateSymlinkQuietly(linktext, link);
// Creating a symlink will fail with ERROR_PRIVILEGE_NOT_HELD if the user
// does not have SeCreateSymbolicLinkPrivilege, or if developer mode is not
// active. In that case, we try to copy the file.
if (status.GetWindows() == ERROR_PRIVILEGE_NOT_HELD) {
status = cmSystemTools::CopyFileAlways(file, link);
} else if (!status) {
- cmSystemTools::Error(errorMessage);
+ cmSystemTools::Error(cmStrCat("failed to create symbolic link '", link,
+ "': ", status.GetString()));
}
return status;
#else