diff options
author | Sven Hesse | 2011-01-29 22:50:11 +0000 |
---|---|---|
committer | Sven Hesse | 2011-01-29 22:50:11 +0000 |
commit | 078162c665bfb7cbb481424acd7fe49772c8a194 (patch) | |
tree | 935ad8a51a28350502195f3491450bf2c9c205c8 /engines/gob | |
parent | ec288c0603ab819061a329db1f290849bfd1e2ae (diff) | |
download | scummvm-rg350-078162c665bfb7cbb481424acd7fe49772c8a194.tar.gz scummvm-rg350-078162c665bfb7cbb481424acd7fe49772c8a194.tar.bz2 scummvm-rg350-078162c665bfb7cbb481424acd7fe49772c8a194.zip |
GOB: Add setExtension()
svn-id: r55639
Diffstat (limited to 'engines/gob')
-rw-r--r-- | engines/gob/util.cpp | 17 | ||||
-rw-r--r-- | engines/gob/util.h | 3 |
2 files changed, 20 insertions, 0 deletions
diff --git a/engines/gob/util.cpp b/engines/gob/util.cpp index fe45adb702..889833ad47 100644 --- a/engines/gob/util.cpp +++ b/engines/gob/util.cpp @@ -518,6 +518,23 @@ void Util::deleteList(List *list) { delete list; } +char *Util::setExtension(char *str, const char *ext) { + char *dot = strrchr(str, '.'); + if (dot) + *dot = '\0'; + + strcat(str, ext); + return str; +} + +Common::String Util::setExtension(const Common::String &str, const Common::String &ext) { + const char *dot = strrchr(str.c_str(), '.'); + if (dot) + return Common::String(str.c_str(), dot - str.c_str()) + ext; + + return str + ext; +} + /* NOT IMPLEMENTED */ void Util::checkJoystick() { _vm->_global->_useJoystick = 0; diff --git a/engines/gob/util.h b/engines/gob/util.h index 6968db1a27..262bff0a7a 100644 --- a/engines/gob/util.h +++ b/engines/gob/util.h @@ -131,6 +131,9 @@ public: static void listDropFront(List *list); static void deleteList(List *list); + static char *setExtension(char *str, const char *ext); + static Common::String setExtension(const Common::String &str, const Common::String &ext); + Util(GobEngine *vm); protected: |