From 15b39466504e7f0fd3bfe9bd49efaed9a33584d9 Mon Sep 17 00:00:00 2001 From: Sven Hesse Date: Tue, 23 Jun 2009 23:55:48 +0000 Subject: Added methods to get the file base from a filename svn-id: r41823 --- engines/gob/totfile.cpp | 10 ++++++++++ engines/gob/totfile.h | 1 + 2 files changed, 11 insertions(+) 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; -- cgit v1.2.3