Masterlist converter work.

* Added CMake instructions.
* Added info to README.
* Fixed a few build errors.
* Parsing errors are now outputted to console.
This commit is contained in:
WrinklyNinja
2013-09-16 10:29:58 +01:00
parent 7a7b973f6a
commit 3a86206de3
4 changed files with 33 additions and 12 deletions
+17 -9
View File
@@ -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})
+6
View File
@@ -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.
+1
View File
@@ -33,6 +33,7 @@
#include "metadata.h"
#include "error.h"
#include "game.h"
#include "streams.h"
#include <string>
#include <vector>
+9 -3
View File
@@ -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<boss::Plugin> test_plugins;
list<boss::Message> 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();