diff --git a/CMakeLists.txt b/CMakeLists.txt index cb1c7a0d..d4ff6961 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -95,14 +95,17 @@ set (BOSS_LIBS version boost_date_time${BOOST_SUFFIX} boost_filesystem${BOOST_SUFFIX} boost_system${BOOST_SUFFIX} - boost_regex${BOOST_SUFFIX} - wx_mswu_webview-2.9-${COMPILER_PREFIX} - wx_mswu_core-2.9-${COMPILER_PREFIX} - wx_baseu-2.9-${COMPILER_PREFIX} - wx_mswu_adv-2.9-${COMPILER_PREFIX} - wxpng-2.9-${COMPILER_PREFIX} - wxzlib-2.9-${COMPILER_PREFIX} - comctl32) + boost_regex${BOOST_SUFFIX}) + +set (BOSS_GUI_LIBS ${BOSS_LIBS} + wx_mswu_webview-2.9-${COMPILER_PREFIX} + wx_mswu_core-2.9-${COMPILER_PREFIX} + wx_baseu-2.9-${COMPILER_PREFIX} + wx_mswu_adv-2.9-${COMPILER_PREFIX} + wxpng-2.9-${COMPILER_PREFIX} + wxzlib-2.9-${COMPILER_PREFIX} + comctl32) + ############################## @@ -115,4 +118,9 @@ target_link_libraries (boss${PROJECT_ARCH} ${BOSS_LIBS}) # Build application. add_executable (BOSS ${BOSS_GUI_SRC}) -target_link_libraries (BOSS ${BOSS_LIBS}) +target_link_libraries (BOSS ${BOSS_GUI_LIBS}) + +# Build converter. +add_executable (masterlist-converter ${BOSS_SRC} "${CMAKE_SOURCE_DIR}/src/converter.cpp") +target_link_libraries (masterlist-converter ${BOSS_LIBS}) + diff --git a/README.md b/README.md index 2b1df0ee..fbe6ed9b 100644 --- a/README.md +++ b/README.md @@ -148,3 +148,9 @@ mkdir build && cd build cmake .. -DPROJECT_LIBS_DIR=".." -DPROJECT_ARCH=32 -DPROJECT_LINK=STATIC -DCMAKE_TOOLCHAIN_FILE="mingw-toolchain.cmake" make ``` + +## Using The Masterlist Converter + +The `masterlist-converter.exe` expects a v2 masterlist named `masterlist.txt` to be present in the same directory as it, and produces a v3 masterlist named `masterlist.txt.yaml`. + +The converter is a command line utility and will print any errors in encounters to the console. It also won't create a v3 masterlist file if errors are encountered. diff --git a/src/backend/legacy-parser.h b/src/backend/legacy-parser.h index 427c5775..b8bb30e7 100644 --- a/src/backend/legacy-parser.h +++ b/src/backend/legacy-parser.h @@ -33,6 +33,7 @@ #include "metadata.h" #include "error.h" #include "game.h" +#include "streams.h" #include #include diff --git a/src/converter.cpp b/src/converter.cpp index 16b03cc5..11f25651 100644 --- a/src/converter.cpp +++ b/src/converter.cpp @@ -29,10 +29,15 @@ using namespace std; int main(int argc, char * argv[]) { - fs::path v2masterlist("../../BOSS/data/boss-skyrim/masterlist.txt"); + boost::filesystem::path v2masterlist("masterlist.txt"); list test_plugins; list globalMessages; - Loadv2Masterlist(v2masterlist, test_plugins, globalMessages); + try { + Loadv2Masterlist(v2masterlist, test_plugins, globalMessages); + } catch (boss::error& e) { + cout << "An error was encountered during masterlist parsing. Message: " << e.what() << endl; + return 1; + } YAML::Emitter yout; yout.SetIndent(2); @@ -41,7 +46,8 @@ int main(int argc, char * argv[]) { << YAML::Key << "plugins" << YAML::Value << test_plugins << YAML::EndMap; - boss::ofstream out(_game.MasterlistPath()); + boost::filesystem::path v3masterlist = v2masterlist.string() + ".yaml"; + boss::ofstream out(v3masterlist); out << yout.c_str(); out.close();