summaryrefslogtreecommitdiff
path: root/zen/file_path.cpp
diff options
context:
space:
mode:
authorB. Stack <bgstack15@gmail.com>2023-01-22 13:56:55 -0500
committerB. Stack <bgstack15@gmail.com>2023-01-22 13:56:55 -0500
commit75e05bc441382db69c842a64c562738cb749214e (patch)
tree698b60b3b4b914bf7958cf1174d0373909bf1e8f /zen/file_path.cpp
parentadd upstream 11.29 (diff)
downloadFreeFileSync-75e05bc441382db69c842a64c562738cb749214e.tar.gz
FreeFileSync-75e05bc441382db69c842a64c562738cb749214e.tar.bz2
FreeFileSync-75e05bc441382db69c842a64c562738cb749214e.zip
add upstream 12.0
Diffstat (limited to 'zen/file_path.cpp')
-rw-r--r--zen/file_path.cpp26
1 files changed, 7 insertions, 19 deletions
diff --git a/zen/file_path.cpp b/zen/file_path.cpp
index 73a3e923..d06ab6bd 100644
--- a/zen/file_path.cpp
+++ b/zen/file_path.cpp
@@ -75,6 +75,13 @@ std::optional<Zstring> zen::getParentFolderPath(const Zstring& itemPath)
}
+Zstring zen::getFileExtension(const ZstringView filePath)
+{
+ const ZstringView fileName = afterLast(filePath, FILE_NAME_SEPARATOR, IfNotFoundReturn::all);
+ return Zstring(afterLast(fileName, Zstr('.'), IfNotFoundReturn::none));
+}
+
+
Zstring zen::appendSeparator(Zstring path) //support rvalue references!
{
assert(!endsWith(path, FILE_NAME_SEPARATOR == Zstr('/') ? Zstr('\\' ) : Zstr('/' )));
@@ -116,25 +123,6 @@ Zstring zen::appendPath(const Zstring& basePath, const Zstring& relPath)
}
-Zstring zen::getFileExtension(const Zstring& filePath)
-{
- //const Zstring fileName = afterLast(filePath, FILE_NAME_SEPARATOR, IfNotFoundReturn::all);
- //return afterLast(fileName, Zstr('.'), IfNotFoundReturn::none);
-
- auto it = zen::findLast(filePath.begin(), filePath.end(), FILE_NAME_SEPARATOR);
- if (it == filePath.end())
- it = filePath.begin();
- else
- ++it;
-
- auto it2 = zen::findLast(it, filePath.end(), Zstr('.'));
- if (it2 != filePath.end())
- ++it2;
-
- return Zstring(it2, filePath.end());
-}
-
-
/* https://docs.microsoft.com/de-de/windows/desktop/Intl/handling-sorting-in-your-applications
Perf test: compare strings 10 mio times; 64 bit build
bgstack15