summaryrefslogtreecommitdiffstats
path: root/mmc_updater/src/tests/TestFileUtils.cpp
diff options
context:
space:
mode:
authorPetr Mrázek <peterix@gmail.com>2013-12-28 02:03:53 +0100
committerPetr Mrázek <peterix@gmail.com>2013-12-28 04:23:48 +0100
commit7652b3d64a63c587f520633364412345083210d4 (patch)
tree12d98c301aa931f20aee0875242bc762cf4d22d1 /mmc_updater/src/tests/TestFileUtils.cpp
parent30d4f5981d3220386bd320534048594fc364d0e9 (diff)
downloadMultiMC-7652b3d64a63c587f520633364412345083210d4.tar
MultiMC-7652b3d64a63c587f520633364412345083210d4.tar.gz
MultiMC-7652b3d64a63c587f520633364412345083210d4.tar.lz
MultiMC-7652b3d64a63c587f520633364412345083210d4.tar.xz
MultiMC-7652b3d64a63c587f520633364412345083210d4.zip
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
Diffstat (limited to 'mmc_updater/src/tests/TestFileUtils.cpp')
-rw-r--r--mmc_updater/src/tests/TestFileUtils.cpp33
1 files changed, 31 insertions, 2 deletions
diff --git a/mmc_updater/src/tests/TestFileUtils.cpp b/mmc_updater/src/tests/TestFileUtils.cpp
index 709acc5c..f8535a28 100644
--- a/mmc_updater/src/tests/TestFileUtils.cpp
+++ b/mmc_updater/src/tests/TestFileUtils.cpp
@@ -5,10 +5,39 @@
void TestFileUtils::testDirName()
{
+ std::string dirName;
+ std::string fileName;
+
#ifdef PLATFORM_WINDOWS
- std::string dirName = FileUtils::dirname("E:/Some Dir/App.exe");
- TEST_COMPARE(dirName,"E:/Some Dir/");
+ // absolute paths
+ dirName = FileUtils::dirname("E:/Some Dir/App.exe");
+ TEST_COMPARE(dirName,"E:/Some Dir");
+ fileName = FileUtils::fileName("E:/Some Dir/App.exe");
+ TEST_COMPARE(fileName,"App.exe");
+
+ dirName = FileUtils::dirname("C:/Users/kitteh/AppData/Local/Temp/MultiMC5-yidaaa/MultiMC.exe");
+ TEST_COMPARE(dirName,"C:/Users/kitteh/AppData/Local/Temp/MultiMC5-yidaaa");
+ fileName = FileUtils::fileName("C:/Users/kitteh/AppData/Local/Temp/MultiMC5-yidaaa/MultiMC.exe");
+ TEST_COMPARE(fileName,"MultiMC.exe");
+
+#else
+ // absolute paths
+ dirName = FileUtils::dirname("/home/tester/foo bar/baz");
+ TEST_COMPARE(dirName,"/home/tester/foo bar");
+ fileName = FileUtils::fileName("/home/tester/foo bar/baz");
+ TEST_COMPARE(fileName,"baz");
#endif
+ // current directory
+ dirName = FileUtils::dirname("App.exe");
+ TEST_COMPARE(dirName,".");
+ fileName = FileUtils::fileName("App.exe");
+ TEST_COMPARE(fileName,"App.exe");
+
+ // relative paths
+ dirName = FileUtils::dirname("Foo/App.exe");
+ TEST_COMPARE(dirName,"Foo");
+ fileName = FileUtils::fileName("Foo/App.exe");
+ TEST_COMPARE(fileName,"App.exe");
}
void TestFileUtils::testIsRelative()