diff options
author | Brad King <brad.king@kitware.com> | 2021-04-15 16:31:41 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2021-04-15 16:40:37 (GMT) |
commit | 7f89053953f81aaa3d0283ba4b8d8b29ce234292 (patch) | |
tree | 691a850495097bd20a59014b715015a4513542d6 /Source/cmSystemTools.cxx | |
parent | 27b5dc35a67f28f46a2b91cf813cd6b34c5a21b8 (diff) | |
download | CMake-7f89053953f81aaa3d0283ba4b8d8b29ce234292.zip CMake-7f89053953f81aaa3d0283ba4b8d8b29ce234292.tar.gz CMake-7f89053953f81aaa3d0283ba4b8d8b29ce234292.tar.bz2 |
cmSystemTools: Return KWSys Status from CreateLink and CreateSymlink
Diffstat (limited to 'Source/cmSystemTools.cxx')
-rw-r--r-- | Source/cmSystemTools.cxx | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index 2b3266d..5382fac 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -3158,9 +3158,9 @@ std::string cmSystemTools::EncodeURL(std::string const& in, bool escapeSlashes) return out; } -bool cmSystemTools::CreateSymlink(const std::string& origName, - const std::string& newName, - std::string* errorMessage) +cmsys::Status cmSystemTools::CreateSymlink(std::string const& origName, + std::string const& newName, + std::string* errorMessage) { uv_fs_t req; int flags = 0; @@ -3171,7 +3171,9 @@ bool cmSystemTools::CreateSymlink(const std::string& origName, #endif int err = uv_fs_symlink(nullptr, &req, origName.c_str(), newName.c_str(), flags, nullptr); + cmsys::Status status; if (err) { + status = cmsys::Status::POSIX(-err); std::string e = "failed to create symbolic link '" + newName + "': " + uv_strerror(err); if (errorMessage) { @@ -3179,20 +3181,20 @@ bool cmSystemTools::CreateSymlink(const std::string& origName, } else { cmSystemTools::Error(e); } - return false; } - - return true; + return status; } -bool cmSystemTools::CreateLink(const std::string& origName, - const std::string& newName, - std::string* errorMessage) +cmsys::Status cmSystemTools::CreateLink(std::string const& origName, + std::string const& newName, + std::string* errorMessage) { uv_fs_t req; int err = uv_fs_link(nullptr, &req, origName.c_str(), newName.c_str(), nullptr); + cmsys::Status status; if (err) { + status = cmsys::Status::POSIX(-err); std::string e = "failed to create link '" + newName + "': " + uv_strerror(err); if (errorMessage) { @@ -3200,10 +3202,8 @@ bool cmSystemTools::CreateLink(const std::string& origName, } else { cmSystemTools::Error(e); } - return false; } - - return true; + return status; } cm::string_view cmSystemTools::GetSystemName() |