diff options
-rw-r--r-- | engines/wintermute/utils/path_util.cpp | 32 | ||||
-rw-r--r-- | engines/wintermute/utils/path_util.h | 14 |
2 files changed, 23 insertions, 23 deletions
diff --git a/engines/wintermute/utils/path_util.cpp b/engines/wintermute/utils/path_util.cpp index 71311713af..db986061f8 100644 --- a/engines/wintermute/utils/path_util.cpp +++ b/engines/wintermute/utils/path_util.cpp @@ -32,8 +32,8 @@ namespace Wintermute { ////////////////////////////////////////////////////////////////////////// -AnsiString PathUtil::unifySeparators(const AnsiString &path) { - AnsiString newPath = path; +Common::String PathUtil::unifySeparators(const Common::String &path) { + Common::String newPath = path; for (uint32 i = 0; i < newPath.size(); i++) { if (newPath[i] == '\\') { @@ -45,16 +45,16 @@ AnsiString PathUtil::unifySeparators(const AnsiString &path) { } ////////////////////////////////////////////////////////////////////////// -AnsiString PathUtil::normalizeFileName(const AnsiString &path) { - AnsiString newPath = unifySeparators(path); +Common::String PathUtil::normalizeFileName(const Common::String &path) { + Common::String newPath = unifySeparators(path); newPath.toLowercase(); return newPath; } ////////////////////////////////////////////////////////////////////////// -AnsiString PathUtil::combine(const AnsiString &path1, const AnsiString &path2) { - AnsiString newPath1 = unifySeparators(path1); - AnsiString newPath2 = unifySeparators(path2); +Common::String PathUtil::combine(const Common::String &path1, const Common::String &path2) { + Common::String newPath1 = unifySeparators(path1); + Common::String newPath2 = unifySeparators(path2); if (!newPath1.hasSuffix("/") && !newPath2.hasPrefix("/")) { newPath1 += "/"; @@ -64,15 +64,15 @@ AnsiString PathUtil::combine(const AnsiString &path1, const AnsiString &path2) { } ////////////////////////////////////////////////////////////////////////// -AnsiString PathUtil::getDirectoryName(const AnsiString &path) { - AnsiString newPath = unifySeparators(path); +Common::String PathUtil::getDirectoryName(const Common::String &path) { + Common::String newPath = unifySeparators(path); Common::String filename = getFileName(path); return Common::String(path.c_str(), path.size() - filename.size()); } ////////////////////////////////////////////////////////////////////////// -AnsiString PathUtil::getFileName(const AnsiString &path) { - AnsiString newPath = unifySeparators(path); +Common::String PathUtil::getFileName(const Common::String &path) { + Common::String newPath = unifySeparators(path); Common::String lastPart = Common::lastPathComponent(newPath, '/'); if (lastPart[lastPart.size() - 1 ] != '/') { return lastPart; @@ -82,10 +82,10 @@ AnsiString PathUtil::getFileName(const AnsiString &path) { } ////////////////////////////////////////////////////////////////////////// -AnsiString PathUtil::getFileNameWithoutExtension(const AnsiString &path) { - AnsiString fileName = getFileName(path); +Common::String PathUtil::getFileNameWithoutExtension(const Common::String &path) { + Common::String fileName = getFileName(path); // TODO: Prettify this. - AnsiString extension = Common::lastPathComponent(fileName, '.'); + Common::String extension = Common::lastPathComponent(fileName, '.'); for (uint32 i = 0; i < extension.size() + 1; i++) { fileName.deleteLastChar(); } @@ -93,8 +93,8 @@ AnsiString PathUtil::getFileNameWithoutExtension(const AnsiString &path) { } ////////////////////////////////////////////////////////////////////////// -AnsiString PathUtil::getExtension(const AnsiString &path) { - AnsiString fileName = getFileName(path); +Common::String PathUtil::getExtension(const Common::String &path) { + Common::String fileName = getFileName(path); return Common::lastPathComponent(path, '.'); } diff --git a/engines/wintermute/utils/path_util.h b/engines/wintermute/utils/path_util.h index 264dc5d241..cc64fb9347 100644 --- a/engines/wintermute/utils/path_util.h +++ b/engines/wintermute/utils/path_util.h @@ -35,13 +35,13 @@ namespace Wintermute { class PathUtil { public: - static AnsiString unifySeparators(const AnsiString &path); - static AnsiString normalizeFileName(const AnsiString &path); - static AnsiString combine(const AnsiString &path1, const AnsiString &path2); - static AnsiString getDirectoryName(const AnsiString &path); - static AnsiString getFileName(const AnsiString &path); - static AnsiString getFileNameWithoutExtension(const AnsiString &path); - static AnsiString getExtension(const AnsiString &path); + static Common::String unifySeparators(const Common::String &path); + static Common::String normalizeFileName(const Common::String &path); + static Common::String combine(const Common::String &path1, const Common::String &path2); + static Common::String getDirectoryName(const Common::String &path); + static Common::String getFileName(const Common::String &path); + static Common::String getFileNameWithoutExtension(const Common::String &path); + static Common::String getExtension(const Common::String &path); }; } // End of namespace Wintermute |