diff options
author | Sven Hesse | 2009-06-23 23:55:48 +0000 |
---|---|---|
committer | Sven Hesse | 2009-06-23 23:55:48 +0000 |
commit | 15b39466504e7f0fd3bfe9bd49efaed9a33584d9 (patch) | |
tree | 4a43ce3c691163012efa456782698cec590d9f13 /engines/gob | |
parent | 82f1ebcafed7e565ac4dce610f7bc098f45ee67d (diff) | |
download | scummvm-rg350-15b39466504e7f0fd3bfe9bd49efaed9a33584d9.tar.gz scummvm-rg350-15b39466504e7f0fd3bfe9bd49efaed9a33584d9.tar.bz2 scummvm-rg350-15b39466504e7f0fd3bfe9bd49efaed9a33584d9.zip |
Added methods to get the file base from a filename
svn-id: r41823
Diffstat (limited to 'engines/gob')
-rw-r--r-- | engines/gob/totfile.cpp | 10 | ||||
-rw-r--r-- | engines/gob/totfile.h | 1 |
2 files changed, 11 insertions, 0 deletions
diff --git a/engines/gob/totfile.cpp b/engines/gob/totfile.cpp index 46d422d44d..2506c00b19 100644 --- a/engines/gob/totfile.cpp +++ b/engines/gob/totfile.cpp @@ -114,4 +114,14 @@ Common::String TOTFile::createFileName(const Common::String &base, bool &isLOM) return base + ".tot"; } +Common::String TOTFile::getFileBase(const Common::String &fileName) { + const char *dot; + if ((dot = strrchr(fileName.c_str(), '.'))) { + // fileName includes an extension + return Common::String(fileName.c_str(), dot); + } + + return fileName; +} + } // End of namespace Gob diff --git a/engines/gob/totfile.h b/engines/gob/totfile.h index 3a82706a7d..f76f695258 100644 --- a/engines/gob/totfile.h +++ b/engines/gob/totfile.h @@ -64,6 +64,7 @@ public: bool getProperties(Properties &props) const; static Common::String createFileName(const Common::String &base, bool &isLOM); + static Common::String getFileBase(const Common::String &fileName); private: GobEngine *_vm; |