diff --git a/CMakeLists.txt b/CMakeLists.txt index 6947dd1a..e9d55eef 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -13,6 +13,8 @@ project (boss) set (BOSS_SRC "${CMAKE_SOURCE_DIR}/src/backend/metadata.cpp" "${CMAKE_SOURCE_DIR}/src/backend/game.cpp" "${CMAKE_SOURCE_DIR}/src/backend/helpers.cpp" "${CMAKE_SOURCE_DIR}/src/backend/network.cpp" "${CMAKE_SOURCE_DIR}/src/backend/globals.cpp" "${PROJECT_LIBS_DIR}/pugixml/src/pugixml.cpp") +set (BOSS_SRC ${BOSS_SRC} "${PROJECT_LIBS_DIR}/boost/libs/iostreams/src/file_descriptor.cpp") + # Include source and library directories. include_directories ("${PROJECT_LIBS_DIR}/alphanum" "${PROJECT_LIBS_DIR}/boost" "${PROJECT_LIBS_DIR}/yaml-cpp/include" "${CMAKE_SOURCE_DIR}/src" "${PROJECT_LIBS_DIR}/libloadorder/src" "${PROJECT_LIBS_DIR}/libespm" "${PROJECT_LIBS_DIR}/zlib" "${PROJECT_LIBS_DIR}/pugixml/src" "${PROJECT_LIBS_DIR}/wxWidgets/include") diff --git a/README.md b/README.md index bf86308e..27c70b22 100644 --- a/README.md +++ b/README.md @@ -101,6 +101,7 @@ Follow the instructions in libloadorder's README to build it as a static library ### BOSS ``` +mkdir build cd build cmake .. -DPROJECT_LIBS_DIR=.. -DPROJECT_ARCH=32 -DPROJECT_LINK=STATIC -DCMAKE_TOOLCHAIN_FILE=mingw-toolchain.cmake make diff --git a/src/api/api.cpp b/src/api/api.cpp index c0f80fc8..1f915226 100644 --- a/src/api/api.cpp +++ b/src/api/api.cpp @@ -591,7 +591,7 @@ BOSS_API unsigned int boss_write_minimal_list (boss_db db, const char * const ou << YAML::Key << "plugins" << YAML::Value << temp << YAML::EndMap; - boss::ofstream out(outputFile); + boss::ofstream out(boost::filesystem::path(outputFile)); if (out.fail()) return boss_error_invalid_args; out << yout.c_str(); diff --git a/src/backend/generators.h b/src/backend/generators.h index 8e3d4d58..2572e3c5 100644 --- a/src/backend/generators.h +++ b/src/backend/generators.h @@ -35,6 +35,7 @@ #include #include #include +#include namespace boss { @@ -509,7 +510,7 @@ namespace boss { yout.SetIndent(2); yout << root; - boss::ofstream out(file.c_str()); + boss::ofstream out(boost::filesystem::path(file)); out << yout.c_str(); out.close(); } diff --git a/src/backend/helpers.cpp b/src/backend/helpers.cpp index 2abfd939..dcbcec40 100644 --- a/src/backend/helpers.cpp +++ b/src/backend/helpers.cpp @@ -125,7 +125,7 @@ namespace boss { uint32_t chksum = 0; static const size_t buffer_size = 8192; char buffer[buffer_size]; - boss::ifstream ifile(filename.string().c_str(), ios::binary); + boss::ifstream ifile(filename, ios::binary); // LOG_TRACE("calculating CRC for: '%s'", filename.string().c_str()); boost::crc_32_type result; if (ifile) { diff --git a/src/backend/streams.h b/src/backend/streams.h new file mode 100644 index 00000000..8c381e83 --- /dev/null +++ b/src/backend/streams.h @@ -0,0 +1,31 @@ +/* BOSS + + A plugin load order optimiser for games that use the esp/esm plugin system. + + Copyright (C) 2012 WrinklyNinja + + This file is part of BOSS. + + BOSS is free software: you can redistribute + it and/or modify it under the terms of the GNU General Public License + as published by the Free Software Foundation, either version 3 of + the License, or (at your option) any later version. + + BOSS is distributed in the hope that it will + be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with BOSS. If not, see + . +*/ + +#include +#include + +namespace boss { + typedef boost::iostreams::stream< boost::iostreams::file_descriptor_sink > ofstream; + typedef boost::iostreams::stream< boost::iostreams::file_descriptor_source > ifstream; + typedef boost::iostreams::stream< boost::iostreams::file_descriptor > fstream; +} diff --git a/src/gui/editor.cpp b/src/gui/editor.cpp index 1951222b..d3d03421 100644 --- a/src/gui/editor.cpp +++ b/src/gui/editor.cpp @@ -650,7 +650,7 @@ void Editor::OnQuit(wxCommandEvent& event) { << YAML::Key << "plugins" << YAML::Value << _editedPlugins << YAML::EndMap; - boss::ofstream out(_userlistPath.c_str()); + boss::ofstream out(fs::path(_userlistPath)); out << yout.c_str(); out.close(); } diff --git a/src/gui/main.cpp b/src/gui/main.cpp index bfebfbb8..7e671bd1 100644 --- a/src/gui/main.cpp +++ b/src/gui/main.cpp @@ -377,7 +377,7 @@ void Launcher::OnClose(wxCloseEvent& event) { yout.SetIndent(2); yout << _settings; - boss::ofstream out(boss::g_path_settings.string().c_str()); + boss::ofstream out(boss::g_path_settings); out << yout.c_str(); out.close(); @@ -653,7 +653,7 @@ void Launcher::OnSortPlugins(wxCommandEvent& event) { << YAML::Key << "plugins" << YAML::Value << ulist_plugins << YAML::EndMap; - boss::ofstream uout(_game.UserlistPath().string().c_str()); + boss::ofstream uout(_game.UserlistPath()); uout << yout.c_str(); uout.close(); @@ -687,7 +687,7 @@ void Launcher::OnSortPlugins(wxCommandEvent& event) { if (fs::exists(_game.ReportPath().string())) { BOOST_LOG_TRIVIAL(debug) << "Reading the previous report's details section."; //Read the whole file in. - boss::ifstream in(_game.ReportPath().string().c_str(), ios::binary); + boss::ifstream in(_game.ReportPath(), ios::binary); in.seekg(0, std::ios::end); oldDetails.resize(in.tellg()); in.seekg(0, std::ios::beg);