diff options
Diffstat (limited to 'engines/zvision/utility.cpp')
-rw-r--r-- | engines/zvision/utility.cpp | 19 |
1 files changed, 19 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 |