summaryrefslogtreecommitdiff
path: root/zen/symlink_target.h
diff options
context:
space:
mode:
authorB Stack <bgstack15@gmail.com>2020-07-22 16:56:03 +0000
committerB Stack <bgstack15@gmail.com>2020-07-22 16:56:03 +0000
commite5633fb1c0db91f01ab967330b76baf4ecdb0512 (patch)
tree10260e25ae905564f7978b83fc4e316670f987c6 /zen/symlink_target.h
parentMerge branch '10.25' into 'master' (diff)
parentadd upstream 11.0 (diff)
downloadFreeFileSync-e5633fb1c0db91f01ab967330b76baf4ecdb0512.tar.gz
FreeFileSync-e5633fb1c0db91f01ab967330b76baf4ecdb0512.tar.bz2
FreeFileSync-e5633fb1c0db91f01ab967330b76baf4ecdb0512.zip
Merge branch '11.0' into 'master'11.0
add upstream 11.0 See merge request opensource-tracking/FreeFileSync!24
Diffstat (limited to 'zen/symlink_target.h')
-rw-r--r--zen/symlink_target.h16
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); }
bgstack15