summaryrefslogtreecommitdiff
path: root/zen/file_access.h
diff options
context:
space:
mode:
Diffstat (limited to 'zen/file_access.h')
-rw-r--r--zen/file_access.h9
1 files changed, 4 insertions, 5 deletions
diff --git a/zen/file_access.h b/zen/file_access.h
index d87fcd0d..5af8b879 100644
--- a/zen/file_access.h
+++ b/zen/file_access.h
@@ -8,6 +8,7 @@
#define FILE_ACCESS_H_8017341345614857
#include <functional>
+#include <variant>
#include "file_path.h"
#include "file_error.h"
#include "serialize.h" //IoCallback
@@ -17,10 +18,6 @@ namespace zen
{
//note: certain functions require COM initialization! (vista_file_op.h)
-//POSITIVE existence checks; if false: 1. item not existing 2. different type 3.device access error or similar
-bool fileAvailable(const Zstring& filePath); //noexcept
-bool dirAvailable (const Zstring& dirPath ); //
-
//FAT/FAT32: "Why does the timestamp of a file *increase* by up to 2 seconds when I copy it to a USB thumb drive?"
const int FAT_FILE_TIME_PRECISION_SEC = 2; //https://devblogs.microsoft.com/oldnewthing/?p=83
//https://web.archive.org/web/20141127143832/http://support.microsoft.com/kb/127830
@@ -42,7 +39,9 @@ ItemType getItemType(const Zstring& itemPath); //throw FileError
//execute potentially SLOW folder traversal but distinguish error/not existing:
// - all child item path parts must correspond to folder traversal
// => we can conclude whether an item is *not* existing anymore by doing a *case-sensitive* name search => potentially SLOW!
-std::optional<ItemType> itemStillExists(const Zstring& itemPath); //throw FileError
+std::variant<ItemType, Zstring /*last existing parent path*/> getItemTypeIfExists(const Zstring& itemPath); //throw FileError
+
+bool itemExists(const Zstring& itemPath); //throw FileError
enum class ProcSymlink
{
bgstack15