Use 'fs' instead of 'std::filesystem'

This commit is contained in:
Kawe Mazidjatari 2022-05-16 21:54:46 +02:00
parent 2e38f2e0dd
commit 637041d5e7
7 changed files with 14 additions and 14 deletions

View File

@ -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;

View File

@ -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);

View File

@ -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()))
{

View File

@ -32,7 +32,7 @@ void CBanSystem::operator[](std::pair<std::string, std::int64_t> 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..

View File

@ -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?
{

View File

@ -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.

View File

@ -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.