diff options
author | B. Stack <bgstack15@gmail.com> | 2022-05-22 21:09:26 +0000 |
---|---|---|
committer | B. Stack <bgstack15@gmail.com> | 2022-05-22 21:09:26 +0000 |
commit | 54c2e44d7b37b2c3efc449e054eef21fa414dfde (patch) | |
tree | 3894ba7e10c78750c195381a861da5e8166a6bfd /zen/file_path.h | |
parent | Merge branch 'b11.20' into 'master' (diff) | |
parent | add upstream 11.21 (diff) | |
download | FreeFileSync-54c2e44d7b37b2c3efc449e054eef21fa414dfde.tar.gz FreeFileSync-54c2e44d7b37b2c3efc449e054eef21fa414dfde.tar.bz2 FreeFileSync-54c2e44d7b37b2c3efc449e054eef21fa414dfde.zip |
Merge branch 'b11.21' into 'master'11.21
add upstream 11.21
See merge request opensource-tracking/FreeFileSync!44
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)); } }; +//------------------------------------------------------------------------------------------ + } |