From 58734a7089a6f1538d1f4b82484fa91860f7a6fd Mon Sep 17 00:00:00 2001 From: Oliver Hamlet Date: Mon, 11 Jul 2016 18:18:49 +0100 Subject: [PATCH] Remove unused LootPaths functions They were only used for tests, but weren't necessary. --- src/backend/app/loot_paths.cpp | 12 ++--------- src/backend/app/loot_paths.h | 2 -- src/tests/backend/app/loot_paths_test.h | 28 ++++++++++--------------- 3 files changed, 13 insertions(+), 29 deletions(-) diff --git a/src/backend/app/loot_paths.cpp b/src/backend/app/loot_paths.cpp index b9cf97d7..9b0add9d 100644 --- a/src/backend/app/loot_paths.cpp +++ b/src/backend/app/loot_paths.cpp @@ -75,14 +75,6 @@ namespace loot { lootDataPath = getLocalAppDataPath() / "LOOT"; } - void LootPaths::setLootAppPath(const boost::filesystem::path& path) { - lootAppPath = path; - } - - void LootPaths::setLootDataPath(const boost::filesystem::path& path) { - lootDataPath = path; - } - boost::filesystem::path LootPaths::getLocalAppDataPath() { #ifdef _WIN32 HWND owner = 0; @@ -113,6 +105,6 @@ namespace loot { #endif } - boost::filesystem::path LootPaths::lootAppPath = boost::filesystem::path(); - boost::filesystem::path LootPaths::lootDataPath = boost::filesystem::path(); + boost::filesystem::path LootPaths::lootAppPath; + boost::filesystem::path LootPaths::lootDataPath; } diff --git a/src/backend/app/loot_paths.h b/src/backend/app/loot_paths.h index b5ecb4f1..f9fd98c1 100644 --- a/src/backend/app/loot_paths.h +++ b/src/backend/app/loot_paths.h @@ -40,8 +40,6 @@ namespace loot { // Sets the app path to the current path, and the data path to the user // local app data path / "LOOT". static void initialise(); - static void setLootAppPath(const boost::filesystem::path& path); - static void setLootDataPath(const boost::filesystem::path& path); private: static boost::filesystem::path lootAppPath; static boost::filesystem::path lootDataPath; diff --git a/src/tests/backend/app/loot_paths_test.h b/src/tests/backend/app/loot_paths_test.h index 037d8939..4892e727 100644 --- a/src/tests/backend/app/loot_paths_test.h +++ b/src/tests/backend/app/loot_paths_test.h @@ -32,39 +32,33 @@ along with LOOT. If not, see namespace loot { namespace test { TEST(LootPaths, getReadmePathShouldUseLootAppPath) { - LootPaths::setLootAppPath("readme"); + LootPaths::initialise(); - EXPECT_EQ(boost::filesystem::path("readme") / "docs" / "LOOT Readme.html", LootPaths::getReadmePath()); + EXPECT_EQ(boost::filesystem::current_path() / "docs" / "LOOT Readme.html", LootPaths::getReadmePath()); } TEST(LootPaths, getUIIndexPathShouldUseLootAppPath) { - LootPaths::setLootAppPath("ui"); + LootPaths::initialise(); - EXPECT_EQ(boost::filesystem::path("ui") / "resources" / "ui" / "index.html", LootPaths::getUIIndexPath()); + EXPECT_EQ(boost::filesystem::current_path() / "resources" / "ui" / "index.html", LootPaths::getUIIndexPath()); } TEST(LootPaths, getL10nPathShouldUseLootAppPath) { - LootPaths::setLootAppPath("l10n"); + LootPaths::initialise(); - EXPECT_EQ(boost::filesystem::path("l10n") / "resources" / "l10n", LootPaths::getL10nPath()); - } - - TEST(LootPaths, getLootDataPathShouldReturnTheSetPath) { - LootPaths::setLootDataPath("data"); - - EXPECT_EQ("data", LootPaths::getLootDataPath()); + EXPECT_EQ(boost::filesystem::current_path() / "resources" / "l10n", LootPaths::getL10nPath()); } TEST(LootPaths, getSettingsPathShouldUseLootDataPath) { - LootPaths::setLootDataPath("settings"); + LootPaths::initialise(); - EXPECT_EQ(boost::filesystem::path("settings") / "settings.yaml", LootPaths::getSettingsPath()); + EXPECT_EQ(LootPaths::getLootDataPath() / "settings.yaml", LootPaths::getSettingsPath()); } TEST(LootPaths, getLogPathShouldUseLootDataPath) { - LootPaths::setLootDataPath("log"); + LootPaths::initialise(); - EXPECT_EQ(boost::filesystem::path("log") / "LOOTDebugLog.txt", LootPaths::getLogPath()); + EXPECT_EQ(LootPaths::getLootDataPath() / "LOOTDebugLog.txt", LootPaths::getLogPath()); } TEST(LootPaths, initialiseShouldSetTheAppPathToTheCurrentPath) { @@ -73,7 +67,7 @@ namespace loot { EXPECT_EQ(boost::filesystem::current_path(), LootPaths::getReadmePath().parent_path().parent_path()); } - TEST(LootPaths, initialiseShouldSetTheAppPathToTheLocalAppDataPathSlashLoot) { + TEST(LootPaths, initialiseShouldSetTheDataPathToTheLocalAppDataPathSlashLoot) { LootPaths::initialise(); // Can't actually know what the path should be, but we can check