diff --git a/CMakeLists.txt b/CMakeLists.txt index a3fa61af..231ec74f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -132,7 +132,7 @@ IF (CMAKE_COMPILER_IS_GNUCXX) ENDIF () set (LOOT_LIBS git2 - libyaml-cpp + yaml-cpp loadorder${PROJECT_ARCH}) ENDIF () diff --git a/src/api/api.cpp b/src/api/api.cpp index 64093c0d..070edfb9 100644 --- a/src/api/api.cpp +++ b/src/api/api.cpp @@ -552,7 +552,7 @@ LOOT_API unsigned int loot_get_tag_map(loot_db db, char *** const tagMap, size_t try { unsigned int UID = 0; for (const auto &tag : allTags) { - db->bashTagMap.emplace(tag, UID); + db->bashTagMap.insert(std::pair(tag, UID)); //Also allocate memory. db->extTagMap[UID] = ToNewCString(tag); UID++; diff --git a/src/backend/game.cpp b/src/backend/game.cpp index 48dbba2a..028369fb 100644 --- a/src/backend/game.cpp +++ b/src/backend/game.cpp @@ -203,11 +203,11 @@ namespace loot { match = *it; // Now we want to also match possibly multiple regex entries. - it = find(regexPlugins.begin(), regexPlugins.end(), plugin); - while (it != regexPlugins.end()) { - match.MergeMetadata(*it); + auto regIt = find(regexPlugins.begin(), regexPlugins.end(), plugin); + while (regIt != regexPlugins.end()) { + match.MergeMetadata(*regIt); - it = find(++it, regexPlugins.end(), plugin); + regIt = find(++regIt, regexPlugins.end(), plugin); } return match; @@ -724,7 +724,7 @@ namespace loot { try { SetLoadOrder(pluginArr, pluginArrSize); } - catch (error &e) { + catch (error &/*e*/) { for (size_t i = 0; i < pluginArrSize; i++) delete[] pluginArr[i]; delete[] pluginArr; @@ -782,7 +782,7 @@ namespace loot { uintmax_t fileSize = fs::file_size(it->path()); meanFileSize += fileSize; - tempMap.emplace(it->path().filename().string(), fileSize); + tempMap.insert(pair(it->path().filename().string(), fileSize)); } } meanFileSize /= tempMap.size(); //Rounding error, but not important. @@ -792,7 +792,7 @@ namespace loot { BOOST_LOG_TRIVIAL(info) << "Found plugin: " << pluginPair.first; //Insert the lowercased name as a key for case-insensitive matching. - auto plugin = plugins.emplace(boost::locale::to_lower(pluginPair.first), Plugin(pluginPair.first)); + auto plugin = plugins.insert(pair(boost::locale::to_lower(pluginPair.first), Plugin(pluginPair.first))); if (pluginPair.second > meanFileSize) { BOOST_LOG_TRIVIAL(trace) << "Creating individual loading thread for: " << pluginPair.first; diff --git a/src/backend/globals.cpp b/src/backend/globals.cpp index 5f41992a..18696ff8 100644 --- a/src/backend/globals.cpp +++ b/src/backend/globals.cpp @@ -35,7 +35,11 @@ namespace loot { const boost::filesystem::path g_path_readme = boost::filesystem::current_path() / "docs" / "LOOT Readme.html"; const boost::filesystem::path g_path_report = boost::filesystem::current_path() / "resources" / "report" / "report.html"; const boost::filesystem::path g_path_l10n = boost::filesystem::current_path() / "resources" / "l10n"; +#ifdef _WIN32 const boost::filesystem::path g_path_local = GetLocalAppDataPath() / "LOOT"; +#else + const boost::filesystem::path g_path_local = boost::filesystem::current_path(); +#endif const boost::filesystem::path g_path_settings = g_path_local / "settings.yaml"; const boost::filesystem::path g_path_log = g_path_local / "LOOTDebugLog.txt"; } diff --git a/src/backend/metadata.cpp b/src/backend/metadata.cpp index a570801c..c6c456f9 100644 --- a/src/backend/metadata.cpp +++ b/src/backend/metadata.cpp @@ -148,7 +148,7 @@ namespace loot { throw loot::error(loot::error::condition_eval_fail, (boost::format(lc::translate("Failed to parse condition \"%1%\".")) % _condition).str()); } - game.conditionCache.emplace(boost::locale::to_lower(_condition), eval); + game.conditionCache.insert(pair(boost::locale::to_lower(_condition), eval)); return eval; } @@ -708,11 +708,11 @@ namespace loot { crc = it->second; else if (boost::filesystem::exists(game.DataPath() / name)) { crc = GetCrc32(game.DataPath() / name); - game.crcCache.emplace(boost::locale::to_lower(name), crc); + game.crcCache.insert(pair(boost::locale::to_lower(name), crc)); } else if (boost::filesystem::exists(game.DataPath() / (name + ".ghost"))) { crc = GetCrc32(game.DataPath() / (name + ".ghost")); - game.crcCache.emplace(boost::locale::to_lower(name), crc); + game.crcCache.insert(pair(boost::locale::to_lower(name), crc)); } else _dirtyInfo.clear(); diff --git a/src/backend/metadata.h b/src/backend/metadata.h index 8598bfc8..43869930 100644 --- a/src/backend/metadata.h +++ b/src/backend/metadata.h @@ -280,7 +280,7 @@ namespace loot { namespace std { template<> struct hash < loot::Plugin > { - size_t operator() (const loot::Plugin& plugin) { + size_t operator() (const loot::Plugin& plugin) const { return hash()(boost::locale::to_lower(plugin.Name())); } }; diff --git a/src/backend/parsers.h b/src/backend/parsers.h index ce3ff117..97d50972 100644 --- a/src/backend/parsers.h +++ b/src/backend/parsers.h @@ -339,7 +339,7 @@ namespace YAML { rhs.clear(); for (const auto &element : node) { - rhs.insert(element.as()); + rhs.insert(element.template as()); } return true; } @@ -361,7 +361,7 @@ namespace YAML { rhs.clear(); for (const auto &element : node) { - rhs.insert(element.as()); + rhs.insert(element.template as()); } return true; } @@ -555,7 +555,7 @@ namespace loot { BOOST_LOG_TRIVIAL(trace) << "Checking to see if any files matching the regex \"" << regexStr << "\" exist."; - regex sepReg("/|(\\\\\\\\)", regex::ECMAScript | regex::icase); + std::regex sepReg("/|(\\\\\\\\)", std::regex::ECMAScript | std::regex::icase); std::vector components; std::sregex_token_iterator it(regexStr.begin(), regexStr.end(), sepReg, -1); @@ -589,11 +589,11 @@ namespace loot { return; } - regex reg; + std::regex reg; try { - reg = regex(filename, regex::ECMAScript | regex::icase); + reg = std::regex(filename, std::regex::ECMAScript | std::regex::icase); } - catch (exception& /*e*/) { + catch (std::exception& /*e*/) { BOOST_LOG_TRIVIAL(error) << "Invalid regex string:" << filename; throw loot::error(loot::error::invalid_args, boost::locale::translate("Invalid regex string:").str() + " " + filename); } @@ -619,7 +619,7 @@ namespace loot { } uint32_t crc; - unordered_map::iterator it = _game->crcCache.find(boost::locale::to_lower(file)); + std::unordered_map::iterator it = _game->crcCache.find(boost::locale::to_lower(file)); if (it != _game->crcCache.end()) crc = it->second; @@ -635,7 +635,7 @@ namespace loot { return; } - _game->crcCache.emplace(boost::locale::to_lower(file), crc); + _game->crcCache.insert(std::pair(boost::locale::to_lower(file), crc)); } result = checksum == crc;