System.cpp: Replace std::filesystem usage (#12474)

This commit is contained in:
Elad Ashkenazi 2022-08-08 05:46:32 +03:00 committed by GitHub
parent 2880370047
commit 47f3740a70
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -43,7 +43,6 @@
#include <memory>
#include <regex>
#include <optional>
#include <filesystem>
#include "Utilities/JIT.h"
@ -1139,16 +1138,19 @@ game_boot_result Emulator::Load(const std::string& title_id, bool add_only, bool
bdvd_dir.push_back('/');
}
if (fs::is_dir(bdvd_dir) && std::filesystem::is_empty(bdvd_dir))
if (!fs::is_file(bdvd_dir + "PS3_DISC.SFB"))
{
// Ignore empty dir. We will need it later for disc games in dev_hdd0.
bdvd_dir.clear();
sys_log.notice("Ignoring empty vfs BDVD directory: '%s'", bdvd_dir);
}
else if (!fs::is_file(bdvd_dir + "PS3_DISC.SFB"))
{
// Unuse if invalid
sys_log.error("Failed to use custom BDVD directory: '%s'", bdvd_dir);
if (fs::get_dir_size(bdvd_dir) == 0)
{
// Ignore empty dir. We will need it later for disc games in dev_hdd0.
sys_log.notice("Ignoring empty vfs BDVD directory: '%s'", bdvd_dir);
}
else
{
// Unuse if invalid
sys_log.error("Failed to use custom BDVD directory: '%s'", bdvd_dir);
}
bdvd_dir.clear();
}
}
@ -1441,7 +1443,7 @@ game_boot_result Emulator::Load(const std::string& title_id, bool add_only, bool
// Disc game located in dev_hdd0/game
bdvd_dir = g_cfg_vfs.get(g_cfg_vfs.dev_bdvd, rpcs3::utils::get_emu_dir());
if (!fs::is_dir(bdvd_dir) || !std::filesystem::is_empty(bdvd_dir))
if (fs::get_dir_size(bdvd_dir))
{
sys_log.error("Failed to load disc game from dev_hdd0. The virtual bdvd_dir path does not exist or the directory is not empty: '%s'", bdvd_dir);
return game_boot_result::invalid_bdvd_folder;