aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSven Hesse2009-06-23 23:55:48 +0000
committerSven Hesse2009-06-23 23:55:48 +0000
commit15b39466504e7f0fd3bfe9bd49efaed9a33584d9 (patch)
tree4a43ce3c691163012efa456782698cec590d9f13
parent82f1ebcafed7e565ac4dce610f7bc098f45ee67d (diff)
downloadscummvm-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
-rw-r--r--engines/gob/totfile.cpp10
-rw-r--r--engines/gob/totfile.h1
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;