diff options
author | B. Stack <bgstack15@gmail.com> | 2022-05-22 17:03:17 -0400 |
---|---|---|
committer | B. Stack <bgstack15@gmail.com> | 2022-05-22 17:03:17 -0400 |
commit | 2c81be72eef5363736cf1892646c74a3311ee4c1 (patch) | |
tree | 3894ba7e10c78750c195381a861da5e8166a6bfd /zen/file_path.h | |
parent | Merge branch 'b11.20' into 'master' (diff) | |
download | FreeFileSync-b11.21.tar.gz FreeFileSync-b11.21.tar.bz2 FreeFileSync-b11.21.zip |
add upstream 11.21b11.21
Diffstat (limited to 'zen/file_path.h')
-rw-r--r-- | zen/file_path.h | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/zen/file_path.h b/zen/file_path.h index e328fa8e..4a85514b 100644 --- a/zen/file_path.h +++ b/zen/file_path.h @@ -12,6 +12,8 @@ namespace zen { + const Zchar FILE_NAME_SEPARATOR = '/'; + struct PathComponents { Zstring rootPath; //itemPath = rootPath + (FILE_NAME_SEPARATOR?) + relPath @@ -21,6 +23,26 @@ std::optional<PathComponents> parsePathComponents(const Zstring& itemPath); //no std::optional<Zstring> getParentFolderPath(const Zstring& itemPath); +Zstring appendSeparator(Zstring path); //support rvalue references! + +bool isValidRelPath(const Zstring& relPath); + +Zstring appendPath(const Zstring& basePath, const Zstring& relPath); + +Zstring getFileExtension(const Zstring& filePath); + +//------------------------------------------------------------------------------------------ +/* Compare *local* file paths: + Windows: igore case (but distinguish Unicode normalization forms!) + Linux: byte-wise comparison + macOS: ignore case + Unicode normalization forms */ +std::weak_ordering compareNativePath(const Zstring& lhs, const Zstring& rhs); + +inline bool equalNativePath(const Zstring& lhs, const Zstring& rhs) { return compareNativePath(lhs, rhs) == std::weak_ordering::equivalent; } + +struct LessNativePath { bool operator()(const Zstring& lhs, const Zstring& rhs) const { return std::is_lt(compareNativePath(lhs, rhs)); } }; +//------------------------------------------------------------------------------------------ + } |