From 637041d5e76f13fb4cf704c7a1ff77ddea4d182f Mon Sep 17 00:00:00 2001 From: Kawe Mazidjatari <48657826+Mauler125@users.noreply.github.com> Date: Mon, 16 May 2022 21:54:46 +0200 Subject: [PATCH] Use 'fs' instead of 'std::filesystem' --- r5dev/engine/cmodel_bsp.cpp | 2 +- r5dev/gameui/IBrowser.cpp | 2 +- r5dev/materialsystem/cmaterialsystem.cpp | 2 +- r5dev/public/bansystem.cpp | 4 ++-- r5dev/sdklauncher/sdklauncher.cpp | 8 ++++---- r5dev/thirdparty/imgui/src/imgui_utility.cpp | 6 +++--- r5dev/vpklib/packedstore.cpp | 4 ++-- 7 files changed, 14 insertions(+), 14 deletions(-) diff --git a/r5dev/engine/cmodel_bsp.cpp b/r5dev/engine/cmodel_bsp.cpp index 7c203f11..22a85df6 100644 --- a/r5dev/engine/cmodel_bsp.cpp +++ b/r5dev/engine/cmodel_bsp.cpp @@ -297,7 +297,7 @@ void MOD_PreloadPakFile(const string& svLevelName) ostringstream ostream; ostream << "platform\\scripts\\levels\\settings\\" << svLevelName << ".json"; - fs::path fsPath = std::filesystem::current_path() /= ostream.str(); + fs::path fsPath = fs::current_path() /= ostream.str(); if (FileExists(fsPath.string().c_str())) { nlohmann::json jsIn; diff --git a/r5dev/gameui/IBrowser.cpp b/r5dev/gameui/IBrowser.cpp index 13d5816c..6057f71a 100644 --- a/r5dev/gameui/IBrowser.cpp +++ b/r5dev/gameui/IBrowser.cpp @@ -44,7 +44,7 @@ IBrowser::IBrowser(void) std::regex rgArchiveRegex{ R"([^_]*_(.*)(.bsp.pak000_dir).*)" }; std::smatch smRegexMatches; - for (const auto& dEntry : std::filesystem::directory_iterator("vpk")) + for (const auto& dEntry : fs::directory_iterator("vpk")) { std::string svFileName = dEntry.path().string(); std::regex_search(svFileName, smRegexMatches, rgArchiveRegex); diff --git a/r5dev/materialsystem/cmaterialsystem.cpp b/r5dev/materialsystem/cmaterialsystem.cpp index d983952f..5a813ae8 100644 --- a/r5dev/materialsystem/cmaterialsystem.cpp +++ b/r5dev/materialsystem/cmaterialsystem.cpp @@ -17,7 +17,7 @@ void HStreamDB_Init(const char* pszStreamDBFile) { std::ostringstream ostream; ostream << "platform\\scripts\\levels\\settings\\" << pszStreamDBFile << ".json"; - std::filesystem::path fsPath = std::filesystem::current_path() /= ostream.str(); + fs::path fsPath = fs::current_path() /= ostream.str(); if (FileExists(fsPath.string().c_str())) { diff --git a/r5dev/public/bansystem.cpp b/r5dev/public/bansystem.cpp index e3a90aa3..43540b57 100644 --- a/r5dev/public/bansystem.cpp +++ b/r5dev/public/bansystem.cpp @@ -32,7 +32,7 @@ void CBanSystem::operator[](std::pair pair) //----------------------------------------------------------------------------- void CBanSystem::Load(void) { - std::filesystem::path path = std::filesystem::current_path() /= "platform\\banlist.json"; + fs::path path = std::filesystem::current_path() /= "platform\\banlist.json"; nlohmann::json jsIn; std::ifstream banFile(path, std::ios::in); @@ -82,7 +82,7 @@ void CBanSystem::Save(void) const jsOut[std::to_string(i).c_str()]["originID"] = vsvBanList[i].second; // Populate originID field for this entry. } - std::filesystem::path path = std::filesystem::current_path() /= "platform\\banlist.json"; + fs::path path = std::filesystem::current_path() /= "platform\\banlist.json"; std::ofstream outFile(path, std::ios::out | std::ios::trunc); // Write config file.. outFile << jsOut.dump(4); // Dump it into config file.. diff --git a/r5dev/sdklauncher/sdklauncher.cpp b/r5dev/sdklauncher/sdklauncher.cpp index 51e85eaa..032cb3d5 100644 --- a/r5dev/sdklauncher/sdklauncher.cpp +++ b/r5dev/sdklauncher/sdklauncher.cpp @@ -23,7 +23,7 @@ bool LaunchR5Apex(eLaunchMode lMode, eLaunchState lState) { case eLaunchMode::LM_DEBUG_GAME: { - std::filesystem::path cfgPath = std::filesystem::current_path() /= "platform\\cfg\\startup_debug.cfg"; // Get cfg path for debug startup. + fs::path cfgPath = fs::current_path() /= "platform\\cfg\\startup_debug.cfg"; // Get cfg path for debug startup. std::ifstream cfgFile(cfgPath); // Read the cfg file. if (cfgFile.good() && cfgFile) // Does the cfg file exist? { @@ -48,7 +48,7 @@ bool LaunchR5Apex(eLaunchMode lMode, eLaunchState lState) } case eLaunchMode::LM_RELEASE_GAME: { - std::filesystem::path cfgPath = std::filesystem::current_path() /= "platform\\cfg\\startup_retail.cfg"; // Get cfg path for release startup. + fs::path cfgPath = fs::current_path() /= "platform\\cfg\\startup_retail.cfg"; // Get cfg path for release startup. std::ifstream cfgFile(cfgPath); // Read the cfg file. if (cfgFile.good() && cfgFile) // Does the cfg file exist? { @@ -73,7 +73,7 @@ bool LaunchR5Apex(eLaunchMode lMode, eLaunchState lState) } case eLaunchMode::LM_DEBUG_DEDI: { - std::filesystem::path cfgPath = std::filesystem::current_path() /= "platform\\cfg\\startup_dedi_debug.cfg"; // Get cfg path for dedicated startup. + fs::path cfgPath = fs::current_path() /= "platform\\cfg\\startup_dedi_debug.cfg"; // Get cfg path for dedicated startup. std::ifstream cfgFile(cfgPath); // Read the cfg file. if (cfgFile.good() && cfgFile) // Does the cfg file exist? { @@ -98,7 +98,7 @@ bool LaunchR5Apex(eLaunchMode lMode, eLaunchState lState) } case eLaunchMode::LM_RELEASE_DEDI: { - std::filesystem::path cfgPath = std::filesystem::current_path() /= "platform\\cfg\\startup_dedi_retail.cfg"; // Get cfg path for dedicated startup. + fs::path cfgPath = fs::current_path() /= "platform\\cfg\\startup_dedi_retail.cfg"; // Get cfg path for dedicated startup. std::ifstream cfgFile(cfgPath); // Read the cfg file. if (cfgFile.good() && cfgFile) // Does the cfg file exist? { diff --git a/r5dev/thirdparty/imgui/src/imgui_utility.cpp b/r5dev/thirdparty/imgui/src/imgui_utility.cpp index 789e46c3..22ad18a2 100644 --- a/r5dev/thirdparty/imgui/src/imgui_utility.cpp +++ b/r5dev/thirdparty/imgui/src/imgui_utility.cpp @@ -44,10 +44,10 @@ void Strtrim(char* s) void ImGuiConfig::Load() { - std::filesystem::path fsPath = "platform\\imgui.json"; + fs::path fsPath = "platform\\imgui.json"; DevMsg(eDLL_T::MS, "Loading ImGui config file '%s'\n", fsPath.relative_path().string().c_str()); - if (std::filesystem::exists(fsPath)) + if (fs::exists(fsPath)) { try { @@ -91,7 +91,7 @@ void ImGuiConfig::Save() jsOut["config"]["IBrowser"]["bind0"] = IBrowser_Config.m_nBind0; jsOut["config"]["IBrowser"]["bind1"] = IBrowser_Config.m_nBind1; - std::filesystem::path fsPath = "platform\\imgui.json"; + fs::path fsPath = "platform\\imgui.json"; DevMsg(eDLL_T::MS, "Saving ImGui config file '%s'\n", fsPath.string().c_str()); std::ofstream outFile(fsPath, std::ios::out | std::ios::trunc); // Write config file. diff --git a/r5dev/vpklib/packedstore.cpp b/r5dev/vpklib/packedstore.cpp index efe8a848..445b286f 100644 --- a/r5dev/vpklib/packedstore.cpp +++ b/r5dev/vpklib/packedstore.cpp @@ -125,7 +125,7 @@ string CPackedStore::FormatBlockPath(string svName, string svPath, string svExte //----------------------------------------------------------------------------- string CPackedStore::StripLocalePrefix(string svPackDirFile) { - std::filesystem::path fspPackDirFile(svPackDirFile); + fs::path fspPackDirFile(svPackDirFile); string svFileName = fspPackDirFile.filename().u8string(); for (int i = 0; i < LANGUAGE_PACKS; i++) @@ -198,7 +198,7 @@ void CPackedStore::UnpackAll(VPKDir_t vpk_dir, string svPathOut) { for (int i = 0; i < vpk_dir.m_vsvArchives.size(); i++) { - std::filesystem::path fspVpkPath(vpk_dir.m_svDirPath); + fs::path fspVpkPath(vpk_dir.m_svDirPath); string svPath = fspVpkPath.parent_path().u8string() + "\\" + vpk_dir.m_vsvArchives[i]; ifstream packChunkStream(svPath, std::ios_base::binary); // Create stream to read from each archive.