diff options
Diffstat (limited to 'engines/zvision')
-rw-r--r-- | engines/zvision/utility.cpp | 19 | ||||
-rw-r--r-- | engines/zvision/utility.h | 2 |
2 files changed, 21 insertions, 0 deletions
diff --git a/engines/zvision/utility.cpp b/engines/zvision/utility.cpp index 41b589d0c0..5f69fd7433 100644 --- a/engines/zvision/utility.cpp +++ b/engines/zvision/utility.cpp @@ -22,6 +22,8 @@ #include "common/scummsys.h" +#include "common/tokenizer.h" + #include "zvision/utility.h" namespace ZVision { @@ -177,4 +179,21 @@ void dumpEveryResultAction(const Common::String &destFile) { output.close(); } +/** + * Gets the name of the file (including extension). Forward or back slashes + * are interpreted as directory changes + * + * @param fullPath A full or partial path to the file. Ex: folderOne/folderTwo/file.txt + * @return The name of the file without any preceding directories. Ex: file.txt + */ +Common::String getFileName(const Common::String &fullPath) { + Common::StringTokenizer tokenizer(fullPath, "/\\"); + Common::String token; + while (!tokenizer.empty()) { + token = tokenizer.nextToken(); + } + + return token; +} + } // End of namespace ZVision diff --git a/engines/zvision/utility.h b/engines/zvision/utility.h index e5713fc7f4..dba765b65c 100644 --- a/engines/zvision/utility.h +++ b/engines/zvision/utility.h @@ -73,6 +73,8 @@ void removeDuplicateEntries(Common::Array<T> *container) { } } +Common::String getFileName(const Common::String &fullPath); + } // End of namespace ZVision #endif |