diff options
author | B Stack <bgstack15@gmail.com> | 2020-07-22 11:37:03 -0400 |
---|---|---|
committer | B Stack <bgstack15@gmail.com> | 2020-07-22 11:37:03 -0400 |
commit | c95b3937fef3e2c63768f1b3b1dc2c898f23d91d (patch) | |
tree | 10260e25ae905564f7978b83fc4e316670f987c6 /zen/symlink_target.h | |
parent | Merge branch '10.25' into 'master' (diff) | |
download | FreeFileSync-c95b3937fef3e2c63768f1b3b1dc2c898f23d91d.tar.gz FreeFileSync-c95b3937fef3e2c63768f1b3b1dc2c898f23d91d.tar.bz2 FreeFileSync-c95b3937fef3e2c63768f1b3b1dc2c898f23d91d.zip |
add upstream 11.0
Diffstat (limited to 'zen/symlink_target.h')
-rw-r--r-- | zen/symlink_target.h | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/zen/symlink_target.h b/zen/symlink_target.h index 077fd4b3..59003284 100644 --- a/zen/symlink_target.h +++ b/zen/symlink_target.h @@ -17,8 +17,13 @@ namespace zen { -Zstring getSymlinkResolvedPath(const Zstring& linkPath); //throw FileError; Win: requires Vista or later! -Zstring getSymlinkTargetRaw (const Zstring& linkPath); //throw FileError +struct SymlinkRawContent +{ + Zstring targetPath; +}; +SymlinkRawContent getSymlinkRawContent(const Zstring& linkPath); //throw FileError + +Zstring getSymlinkResolvedPath(const Zstring& linkPath); //throw FileError } @@ -34,7 +39,7 @@ Zstring getSymlinkTargetRaw (const Zstring& linkPath); //throw FileError namespace { //retrieve raw target data of symlink or junction -Zstring getSymlinkRawTargetString_impl(const Zstring& linkPath) //throw FileError +zen::SymlinkRawContent getSymlinkRawContent_impl(const Zstring& linkPath) //throw FileError { using namespace zen; const size_t BUFFER_SIZE = 10000; @@ -46,7 +51,7 @@ Zstring getSymlinkRawTargetString_impl(const Zstring& linkPath) //throw FileErro if (bytesWritten >= static_cast<ssize_t>(BUFFER_SIZE)) //detect truncation, not an error for readlink! throw FileError(replaceCpy(_("Cannot resolve symbolic link %x."), L"%x", fmtPath(linkPath)), formatSystemError("readlink", L"", L"Buffer truncated.")); - return Zstring(&buffer[0], bytesWritten); //readlink does not append 0-termination! + return {Zstring(&buffer[0], bytesWritten)}; //readlink does not append 0-termination! } @@ -65,7 +70,8 @@ Zstring getResolvedSymlinkPath_impl(const Zstring& linkPath) //throw FileError namespace zen { inline -Zstring getSymlinkTargetRaw(const Zstring& linkPath) { return getSymlinkRawTargetString_impl(linkPath); } +SymlinkRawContent getSymlinkRawContent(const Zstring& linkPath) { return getSymlinkRawContent_impl(linkPath); } + inline Zstring getSymlinkResolvedPath(const Zstring& linkPath) { return getResolvedSymlinkPath_impl(linkPath); } |