From 7652b3d64a63c587f520633364412345083210d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Mr=C3=A1zek?= Date: Sat, 28 Dec 2013 02:03:53 +0100 Subject: Various updater fixes Updater tests for path utils The updater now doesn't use splitpath on Windows (fixes problems with Windows XP) Fix up paths for the OSX updater - should now install the updates into the right place Fix translations install path - translation isntall and deploy should be fixed --- mmc_updater/src/FileUtils.cpp | 44 ++----------------------------------------- 1 file changed, 2 insertions(+), 42 deletions(-) (limited to 'mmc_updater/src/FileUtils.cpp') diff --git a/mmc_updater/src/FileUtils.cpp b/mmc_updater/src/FileUtils.cpp index 10435e49..712c0c5d 100644 --- a/mmc_updater/src/FileUtils.cpp +++ b/mmc_updater/src/FileUtils.cpp @@ -10,6 +10,8 @@ #include #include #include +// this actually works with mingw32, which we use. +#include #ifdef PLATFORM_UNIX #include @@ -19,7 +21,6 @@ #include #include #include -#include #endif FileUtils::IOException::IOException(const std::string& error) @@ -249,59 +250,18 @@ void FileUtils::removeFile(const char* src) throw (IOException) std::string FileUtils::fileName(const char* path) { -#ifdef PLATFORM_UNIX char* pathCopy = strdup(path); std::string basename = ::basename(pathCopy); free(pathCopy); return basename; -#else - char baseName[MAX_PATH]; - char extension[MAX_PATH]; - _splitpath_s(path, - 0, /* drive */ - 0, /* drive length */ - 0, /* dir */ - 0, /* dir length */ - baseName, - MAX_PATH, /* baseName length */ - extension, - MAX_PATH /* extension length */ - ); - return std::string(baseName) + std::string(extension); -#endif } std::string FileUtils::dirname(const char* path) { -#ifdef PLATFORM_UNIX char* pathCopy = strdup(path); std::string dirname = ::dirname(pathCopy); free(pathCopy); return dirname; -#else - char drive[3]; - char dir[MAX_PATH]; - - _splitpath_s(path, - drive, /* drive */ - 3, /* drive length */ - dir, - MAX_PATH, /* dir length */ - 0, /* filename */ - 0, /* filename length */ - 0, /* extension */ - 0 /* extension length */ - ); - - std::string result; - if (drive[0]) - { - result += std::string(drive); - } - result += dir; - - return result; -#endif } void FileUtils::touch(const char* path) throw (IOException) -- cgit v1.2.3