diff options
author | B. Stack <bgstack15@gmail.com> | 2021-12-06 13:37:35 +0000 |
---|---|---|
committer | B. Stack <bgstack15@gmail.com> | 2021-12-06 13:37:35 +0000 |
commit | f142f32c8d2b53f305cb72cb5953e3394d6a6243 (patch) | |
tree | 2999df8f80b28d0f7f60a84b7f75d613e280bba1 /zen/symlink_target.h | |
parent | Merge branch 'b11.14' into 'master' (diff) | |
parent | add upstream 11.15 (diff) | |
download | FreeFileSync-f142f32c8d2b53f305cb72cb5953e3394d6a6243.tar.gz FreeFileSync-f142f32c8d2b53f305cb72cb5953e3394d6a6243.tar.bz2 FreeFileSync-f142f32c8d2b53f305cb72cb5953e3394d6a6243.zip |
Merge branch 'b11.15' into 'master'11.15
add upstream 11.15
See merge request opensource-tracking/FreeFileSync!39
Diffstat (limited to 'zen/symlink_target.h')
-rw-r--r-- | zen/symlink_target.h | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/zen/symlink_target.h b/zen/symlink_target.h index 32b1211d..60353292 100644 --- a/zen/symlink_target.h +++ b/zen/symlink_target.h @@ -9,6 +9,7 @@ #include "scope_guard.h" #include "file_error.h" +#include "file_path.h" #include <unistd.h> #include <stdlib.h> //realpath @@ -58,11 +59,15 @@ zen::SymlinkRawContent getSymlinkRawContent_impl(const Zstring& linkPath) //thro Zstring getResolvedSymlinkPath_impl(const Zstring& linkPath) //throw FileError { using namespace zen; - char* targetPath = ::realpath(linkPath.c_str(), nullptr); - if (!targetPath) - THROW_LAST_FILE_ERROR(replaceCpy(_("Cannot determine final path for %x."), L"%x", fmtPath(linkPath)), "realpath"); - ZEN_ON_SCOPE_EXIT(::free(targetPath)); - return targetPath; + try + { + char* targetPath = ::realpath(linkPath.c_str(), nullptr); + if (!targetPath) + THROW_LAST_SYS_ERROR("realpath"); + ZEN_ON_SCOPE_EXIT(::free(targetPath)); + return targetPath; + } + catch (const SysError& e) { throw FileError(replaceCpy(_("Cannot determine final path for %x."), L"%x", fmtPath(linkPath)), e.toString()); } } } |