diff options
author | Brad King <brad.king@kitware.com> | 2021-05-10 14:09:53 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2021-05-10 14:09:59 (GMT) |
commit | 74d35f569316fcd09e1604ac87e53bfb16367a8d (patch) | |
tree | d90dd7fece3eb1d240d11d7d3c61e185c3b667dc /Source | |
parent | 6f9a513181935b3543494e78d3d35c7ad21496fc (diff) | |
parent | d7522b8f864db8df25b99eeabc625e55ad690a3e (diff) | |
download | CMake-74d35f569316fcd09e1604ac87e53bfb16367a8d.zip CMake-74d35f569316fcd09e1604ac87e53bfb16367a8d.tar.gz CMake-74d35f569316fcd09e1604ac87e53bfb16367a8d.tar.bz2 |
Merge topic 'windows-symlink-errors'
d7522b8f86 cmSystemTools: Improve CreateLink and CreateSymlink error codes
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !6096
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmSystemTools.cxx | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index 9e46dab..ab42810 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -3173,9 +3173,15 @@ cmsys::Status cmSystemTools::CreateSymlink(std::string const& origName, flags, nullptr); cmsys::Status status; if (err) { +#if defined(_WIN32) + status = cmsys::Status::Windows(uv_fs_get_system_error(&req)); +#elif UV_VERSION_MAJOR > 1 || (UV_VERSION_MAJOR == 1 && UV_VERSION_MINOR >= 38) + status = cmsys::Status::POSIX(uv_fs_get_system_error(&req)); +#else status = cmsys::Status::POSIX(-err); - std::string e = - "failed to create symbolic link '" + newName + "': " + uv_strerror(err); +#endif + std::string e = cmStrCat("failed to create symbolic link '", newName, + "': ", status.GetString()); if (errorMessage) { *errorMessage = std::move(e); } else { @@ -3194,9 +3200,15 @@ cmsys::Status cmSystemTools::CreateLink(std::string const& origName, uv_fs_link(nullptr, &req, origName.c_str(), newName.c_str(), nullptr); cmsys::Status status; if (err) { +#if defined(_WIN32) + status = cmsys::Status::Windows(uv_fs_get_system_error(&req)); +#elif UV_VERSION_MAJOR > 1 || (UV_VERSION_MAJOR == 1 && UV_VERSION_MINOR >= 38) + status = cmsys::Status::POSIX(uv_fs_get_system_error(&req)); +#else status = cmsys::Status::POSIX(-err); +#endif std::string e = - "failed to create link '" + newName + "': " + uv_strerror(err); + cmStrCat("failed to create link '", newName, "': ", status.GetString()); if (errorMessage) { *errorMessage = std::move(e); } else { |