GOB: Add setExtension()

svn-id: r55639
This commit is contained in:
Sven Hesse 2011-01-29 22:50:11 +00:00
parent ec288c0603
commit 078162c665
2 changed files with 20 additions and 0 deletions

View File

@ -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;

View File

@ -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: