diff options
author | Brad King <brad.king@kitware.com> | 2022-10-06 17:44:27 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2022-10-06 18:38:53 (GMT) |
commit | aba48bd6acbf564dcb5b831b26cc01743b5b5f71 (patch) | |
tree | 9b0d1e44f351ee52509095fb801509e630f5814f /Source/cmcmd.cxx | |
parent | 2133cf2c8e575bfff000041505208e28bcdfd4a3 (diff) | |
download | CMake-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.cxx | 7 |
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 |