Move LootPaths into GUI code

This commit is contained in:
Oliver Hamlet
2017-02-06 18:01:55 +00:00
parent 355eb3fd2f
commit 4237895e7c
17 changed files with 27 additions and 33 deletions
+10 -8
View File
@@ -162,8 +162,7 @@ set(CEF_PRECOMPILED_BINARIES_DIR "${SOURCE_DIR}/Release")
# General Settings
##############################
set (LOOT_SRC "${CMAKE_SOURCE_DIR}/src/backend/app/loot_paths.cpp"
"${CMAKE_BINARY_DIR}/generated/loot_version.cpp"
set (LOOT_SRC "${CMAKE_BINARY_DIR}/generated/loot_version.cpp"
"${CMAKE_SOURCE_DIR}/src/backend/error_categories.cpp"
"${CMAKE_SOURCE_DIR}/src/backend/metadata/condition_evaluator.cpp"
"${CMAKE_SOURCE_DIR}/src/backend/metadata/conditional_metadata.cpp"
@@ -188,8 +187,7 @@ set (LOOT_SRC "${CMAKE_SOURCE_DIR}/src/backend/app/loot_paths.cpp"
"${CMAKE_SOURCE_DIR}/src/backend/helpers/language.cpp"
"${CMAKE_SOURCE_DIR}/src/backend/helpers/version.cpp")
set (LOOT_HEADERS "${CMAKE_SOURCE_DIR}/src/backend/app/loot_paths.h"
"${CMAKE_SOURCE_DIR}/src/backend/metadata/condition_evaluator.h"
set (LOOT_HEADERS "${CMAKE_SOURCE_DIR}/src/backend/metadata/condition_evaluator.h"
"${CMAKE_SOURCE_DIR}/src/backend/metadata/condition_grammar.h"
"${CMAKE_SOURCE_DIR}/src/backend/metadata/conditional_metadata.h"
"${CMAKE_SOURCE_DIR}/src/backend/metadata/file.h"
@@ -232,6 +230,7 @@ set (LOOT_GUI_SRC "${CMAKE_SOURCE_DIR}/src/gui/main.cpp"
"${CMAKE_SOURCE_DIR}/src/gui/loot_app.cpp"
"${CMAKE_SOURCE_DIR}/src/gui/loot_scheme_handler_factory.cpp"
"${CMAKE_SOURCE_DIR}/src/gui/query_handler.cpp"
"${CMAKE_SOURCE_DIR}/src/gui/state/loot_paths.cpp"
"${CMAKE_SOURCE_DIR}/src/gui/state/loot_settings.cpp"
"${CMAKE_SOURCE_DIR}/src/gui/state/loot_state.cpp"
"${CMAKE_SOURCE_DIR}/src/resource.rc")
@@ -272,6 +271,7 @@ set (LOOT_GUI_HEADERS "${CMAKE_SOURCE_DIR}/src/gui/editor_message.h"
"${CMAKE_SOURCE_DIR}/src/gui/query/sort_plugins_query.h"
"${CMAKE_SOURCE_DIR}/src/gui/query/update_masterlist_query.h"
"${CMAKE_SOURCE_DIR}/src/gui/query_handler.h"
"${CMAKE_SOURCE_DIR}/src/gui/state/loot_paths.h"
"${CMAKE_SOURCE_DIR}/src/gui/state/loot_settings.h"
"${CMAKE_SOURCE_DIR}/src/gui/state/loot_state.h"
"${CMAKE_SOURCE_DIR}/src/gui/resource.h"
@@ -302,8 +302,7 @@ set (LOOT_API_HEADERS "${CMAKE_SOURCE_DIR}/include/loot/api.h"
set (LOOT_TESTS_SRC "${CMAKE_SOURCE_DIR}/src/tests/backend/main.cpp")
set (LOOT_TESTS_HEADERS "${CMAKE_SOURCE_DIR}/src/tests/backend/app/loot_paths_test.h"
"${CMAKE_SOURCE_DIR}/src/tests/backend/game/game_test.h"
set (LOOT_TESTS_HEADERS "${CMAKE_SOURCE_DIR}/src/tests/backend/game/game_test.h"
"${CMAKE_SOURCE_DIR}/src/tests/backend/game/game_cache_test.h"
"${CMAKE_SOURCE_DIR}/src/tests/backend/game/game_settings_test.h"
"${CMAKE_SOURCE_DIR}/src/tests/backend/game/load_order_handler_test.h"
@@ -337,12 +336,15 @@ set(LOOT_API_TESTS_HEADERS "${CMAKE_SOURCE_DIR}/src/tests/api/api_game_operatio
"${CMAKE_SOURCE_DIR}/src/tests/api/is_compatible_test.h"
"${CMAKE_SOURCE_DIR}/src/tests/common_game_test_fixture.h")
set(LOOT_GUI_TESTS_SRC "${CMAKE_SOURCE_DIR}/src/gui/state/loot_settings.cpp"
set(LOOT_GUI_TESTS_SRC "${CMAKE_SOURCE_DIR}/src/gui/state/loot_paths.cpp"
"${CMAKE_SOURCE_DIR}/src/gui/state/loot_settings.cpp"
"${CMAKE_SOURCE_DIR}/src/gui/state/loot_state.cpp"
"${CMAKE_SOURCE_DIR}/src/tests/gui/main.cpp")
set (LOOT_GUI_TESTS_HEADERS "${CMAKE_SOURCE_DIR}/src/gui/state/loot_settings.h"
set (LOOT_GUI_TESTS_HEADERS "${CMAKE_SOURCE_DIR}/src/gui/state/loot_paths.h"
"${CMAKE_SOURCE_DIR}/src/gui/state/loot_settings.h"
"${CMAKE_SOURCE_DIR}/src/gui/state/loot_state.h"
"${CMAKE_SOURCE_DIR}/src/tests/gui/state/loot_paths_test.h"
"${CMAKE_SOURCE_DIR}/src/tests/gui/state/loot_settings_test.h"
"${CMAKE_SOURCE_DIR}/src/tests/gui/state/loot_state_test.h")
+3 -2
View File
@@ -28,7 +28,6 @@
#include <boost/log/core.hpp>
#include "api/api_database.h"
#include "backend/app/loot_paths.h"
namespace fs = boost::filesystem;
@@ -50,7 +49,9 @@ LOOT_API bool IsCompatible(const unsigned int versionMajor, const unsigned int v
LOOT_API std::shared_ptr<DatabaseInterface> CreateDatabase(const GameType game,
const std::string& gamePath,
const std::string& gameLocalPath) {
loot::LootPaths::initialise("");
// Set the locale to get UTF-8 conversions working correctly.
std::locale::global(boost::locale::generator().generate(""));
boost::filesystem::path::imbue(std::locale());
//Disable logging or else stdout will get overrun.
boost::log::core::get()->set_logging_enabled(false);
+1 -1
View File
@@ -28,7 +28,7 @@
#include <include/cef_browser.h>
#include <include/cef_task.h>
#include "backend/app/loot_paths.h"
#include "gui/state/loot_paths.h"
#include "backend/helpers/helpers.h"
#include "backend/helpers/language.h"
#include "gui/loot_handler.h"
+1 -1
View File
@@ -36,7 +36,7 @@
#include <include/cef_task.h>
#include <include/wrapper/cef_closure_task.h>
#include "backend/app/loot_paths.h"
#include "gui/state/loot_paths.h"
#include "gui/helpers.h"
#include "gui/loot_scheme_handler_factory.h"
#include "gui/query_handler.h"
+1 -1
View File
@@ -24,7 +24,7 @@ along with LOOT. If not, see
#include "loot_scheme_handler_factory.h"
#include "backend/app/loot_paths.h"
#include "gui/state/loot_paths.h"
#include <include/cef_parser.h>
#include <include/wrapper/cef_stream_resource_handler.h>
+1 -1
View File
@@ -31,7 +31,7 @@
#include <boost/log/utility/setup/common_attributes.hpp>
#include <boost/log/utility/setup/file.hpp>
#include "backend/app/loot_paths.h"
#include "gui/state/loot_paths.h"
#include "gui/loot_app.h"
#ifdef _WIN32
+1 -1
View File
@@ -25,7 +25,7 @@ along with LOOT. If not, see
#ifndef LOOT_GUI_QUERY_OPEN_LOG_LOCATION_QUERY
#define LOOT_GUI_QUERY_OPEN_LOG_LOCATION_QUERY
#include "backend/app/loot_paths.h"
#include "gui/state/loot_paths.h"
#include "gui/helpers.h"
#include "gui/query/query.h"
+1 -1
View File
@@ -25,7 +25,7 @@ along with LOOT. If not, see
#ifndef LOOT_GUI_QUERY_OPEN_README_QUERY
#define LOOT_GUI_QUERY_OPEN_README_QUERY
#include "backend/app/loot_paths.h"
#include "gui/state/loot_paths.h"
#include "gui/helpers.h"
#include "gui/query/query.h"
+1 -1
View File
@@ -70,7 +70,7 @@
#include "gui/resource.h"
#include "gui/yaml_simple_message_helpers.h"
#include "backend/app/loot_paths.h"
#include "gui/state/loot_paths.h"
#include "backend/plugin/plugin_sorter.h"
#include "backend/helpers/helpers.h"
#include "gui/query/json.h"
+1 -1
View File
@@ -28,7 +28,7 @@
#include <boost/filesystem/fstream.hpp>
#include "backend/app/loot_paths.h"
#include "gui/state/loot_paths.h"
#include "loot/loot_version.h"
using std::lock_guard;
+2 -2
View File
@@ -35,9 +35,9 @@
#include <boost/log/utility/setup/file.hpp>
#include "loot/exception/game_detection_error.h"
#include "backend/app/loot_paths.h"
#include "backend/helpers/helpers.h"
#include "backend/helpers/language.h"
#include "gui/state/loot_paths.h"
#include "loot/loot_version.h"
#ifdef _WIN32
@@ -290,7 +290,7 @@ std::list<Game> LootState::toGames(const std::vector<GameSettings>& settings) {
for (const auto& element : settings) {
games.push_back(Game(element, LootPaths::getLootDataPath()));
}
return games;
}
+2 -11
View File
@@ -95,15 +95,6 @@ TEST_P(GameTest, isInstalledShouldBeTrueIfGamePathIsValid) {
TEST_P(GameTest, initShouldThrowOnLinuxIfGamePathIsNotGiven) {
Game game = Game(GameSettings(GetParam()), "");
EXPECT_THROW(game.Init(), GameDetectionError);
game = Game(GameSettings(GetParam()), lootDataPath);
EXPECT_THROW(game.Init(), GameDetectionError);
game = Game(GameSettings(GetParam()), "", localPath);
EXPECT_THROW(game.Init(), GameDetectionError);
game = Game(GameSettings(GetParam()), lootDataPath, localPath);
EXPECT_THROW(game.Init(), GameDetectionError);
}
TEST_P(GameTest, initShouldThrowOnLinuxIfLocalPathIsNotGiven) {
@@ -113,14 +104,14 @@ TEST_P(GameTest, initShouldThrowOnLinuxIfLocalPathIsNotGiven) {
}
#else
TEST_P(GameTest, initShouldNotThrowOnWindowsIfLocalPathIsNotGiven) {
Game game = Game(GameSettings(GetParam()).SetGamePath(dataPath.parent_path()), "");
Game game = Game(GameSettings(GetParam()).SetGamePath(dataPath.parent_path()), "", localPath);
EXPECT_NO_THROW(game.Init());
}
#endif
TEST_P(GameTest, initShouldNotCreateAGameFolderIfTheLootDataPathIsEmpty) {
Game game = Game(GameSettings(GetParam()).SetGamePath(dataPath.parent_path()), "");
Game game = Game(GameSettings(GetParam()).SetGamePath(dataPath.parent_path()), "", localPath);
ASSERT_FALSE(boost::filesystem::exists(lootDataPath / game.FolderName()));
EXPECT_NO_THROW(game.Init());
-1
View File
@@ -24,7 +24,6 @@
#include <boost/log/core.hpp>
#include "tests/backend/app/loot_paths_test.h"
#include "tests/backend/game/game_test.h"
#include "tests/backend/game/game_cache_test.h"
#include "tests/backend/game/game_settings_test.h"
+1
View File
@@ -24,6 +24,7 @@
#include <boost/log/core.hpp>
#include "tests/gui/state/loot_paths_test.h"
#include "tests/gui/state/loot_settings_test.h"
#include "tests/gui/state/loot_state_test.h"
@@ -25,7 +25,7 @@ along with LOOT. If not, see
#ifndef LOOT_TESTS_BACKEND_LOOT_PATHS_TEST
#define LOOT_TESTS_BACKEND_LOOT_PATHS_TEST
#include "backend/app/loot_paths.h"
#include "gui/state/loot_paths.h"
#include <gtest/gtest.h>