summaryrefslogtreecommitdiff
path: root/zen/file_access.cpp
diff options
context:
space:
mode:
authorB Stack <bgstack15@gmail.com>2018-09-10 02:46:25 +0000
committerB Stack <bgstack15@gmail.com>2018-09-10 02:46:25 +0000
commit728d32e6da9ce66968f8eef47a59505d613e2c1b (patch)
tree0f0441755ff0e6d65e12222d4502c648bffd6a7c /zen/file_access.cpp
parent10.3 (diff)
parentpull in latest 10.4 from upstream (diff)
downloadFreeFileSync-728d32e6da9ce66968f8eef47a59505d613e2c1b.tar.gz
FreeFileSync-728d32e6da9ce66968f8eef47a59505d613e2c1b.tar.bz2
FreeFileSync-728d32e6da9ce66968f8eef47a59505d613e2c1b.zip
Merge branch '10.4' into 'master'10.4
pull in latest 10.4 from upstream See merge request opensource-tracking/FreeFileSync!1
Diffstat (limited to 'zen/file_access.cpp')
-rwxr-xr-xzen/file_access.cpp24
1 files changed, 12 insertions, 12 deletions
diff --git a/zen/file_access.cpp b/zen/file_access.cpp
index 9c351e25..a81fdae0 100755
--- a/zen/file_access.cpp
+++ b/zen/file_access.cpp
@@ -30,9 +30,9 @@
using namespace zen;
-Opt<PathComponents> zen::parsePathComponents(const Zstring& itemPath)
+std::optional<PathComponents> zen::parsePathComponents(const Zstring& itemPath)
{
- auto doParse = [&](int sepCountVolumeRoot, bool rootWithSep) -> Opt<PathComponents>
+ auto doParse = [&](int sepCountVolumeRoot, bool rootWithSep) -> std::optional<PathComponents>
{
const Zstring itemPathFmt = appendSeparator(itemPath); //simplify analysis of root without separator, e.g. \\server-name\share
int sepCount = 0;
@@ -47,7 +47,7 @@ Opt<PathComponents> zen::parsePathComponents(const Zstring& itemPath)
return PathComponents({ rootPath, relPath });
}
- return NoValue();
+ return {};
};
if (startsWith(itemPath, "/"))
@@ -72,17 +72,17 @@ Opt<PathComponents> zen::parsePathComponents(const Zstring& itemPath)
}
//we do NOT support relative paths!
- return NoValue();
+ return {};
}
-Opt<Zstring> zen::getParentFolderPath(const Zstring& itemPath)
+std::optional<Zstring> zen::getParentFolderPath(const Zstring& itemPath)
{
- if (const Opt<PathComponents> comp = parsePathComponents(itemPath))
+ if (const std::optional<PathComponents> comp = parsePathComponents(itemPath))
{
if (comp->relPath.empty())
- return NoValue();
+ return {};
const Zstring parentRelPath = beforeLast(comp->relPath, FILE_NAME_SEPARATOR, IF_MISSING_RETURN_NONE);
if (parentRelPath.empty())
@@ -90,7 +90,7 @@ Opt<Zstring> zen::getParentFolderPath(const Zstring& itemPath)
return appendSeparator(comp->rootPath) + parentRelPath;
}
assert(false);
- return NoValue();
+ return {};
}
@@ -110,7 +110,7 @@ ItemType zen::getItemType(const Zstring& itemPath) //throw FileError
PathStatus zen::getPathStatus(const Zstring& itemPath) //throw FileError
{
- const Opt<Zstring> parentPath = getParentFolderPath(itemPath);
+ const std::optional<Zstring> parentPath = getParentFolderPath(itemPath);
try
{
return { getItemType(itemPath), itemPath, {} }; //throw FileError
@@ -145,12 +145,12 @@ PathStatus zen::getPathStatus(const Zstring& itemPath) //throw FileError
}
-Opt<ItemType> zen::getItemTypeIfExists(const Zstring& itemPath) //throw FileError
+std::optional<ItemType> zen::getItemTypeIfExists(const Zstring& itemPath) //throw FileError
{
const PathStatus ps = getPathStatus(itemPath); //throw FileError
if (ps.relPath.empty())
return ps.existingType;
- return NoValue();
+ return {};
}
@@ -672,7 +672,7 @@ FileCopyResult copyFileOsSpecific(const Zstring& sourceFile, //throw FileError,
//close output file handle before setting file time; also good place to catch errors when closing stream!
fileOut.finalize(); //throw FileError, (X) essentially a close() since buffers were already flushed
- Opt<FileError> errorModTime;
+ std::optional<FileError> errorModTime;
try
{
//we cannot set the target file times (::futimes) while the file descriptor is still open after a write operation:
bgstack15