mirror of
https://github.com/RPCS3/rpcs3.git
synced 2024-11-25 12:12:50 +01:00
rename fs::stat to fs::get_stat
This commit is contained in:
parent
73c3d5fc81
commit
bc40b61ef1
@ -502,7 +502,7 @@ std::string_view fs::get_parent_dir_view(std::string_view path, u32 parent_level
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool fs::stat(const std::string& path, stat_t& info)
|
bool fs::get_stat(const std::string& path, stat_t& info)
|
||||||
{
|
{
|
||||||
// Ensure consistent information on failure
|
// Ensure consistent information on failure
|
||||||
info = {};
|
info = {};
|
||||||
@ -618,13 +618,13 @@ bool fs::stat(const std::string& path, stat_t& info)
|
|||||||
bool fs::exists(const std::string& path)
|
bool fs::exists(const std::string& path)
|
||||||
{
|
{
|
||||||
fs::stat_t info{};
|
fs::stat_t info{};
|
||||||
return fs::stat(path, info);
|
return fs::get_stat(path, info);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool fs::is_file(const std::string& path)
|
bool fs::is_file(const std::string& path)
|
||||||
{
|
{
|
||||||
fs::stat_t info{};
|
fs::stat_t info{};
|
||||||
if (!fs::stat(path, info))
|
if (!fs::get_stat(path, info))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -641,7 +641,7 @@ bool fs::is_file(const std::string& path)
|
|||||||
bool fs::is_dir(const std::string& path)
|
bool fs::is_dir(const std::string& path)
|
||||||
{
|
{
|
||||||
fs::stat_t info{};
|
fs::stat_t info{};
|
||||||
if (!fs::stat(path, info))
|
if (!fs::get_stat(path, info))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -186,7 +186,7 @@ namespace fs
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Get file information
|
// Get file information
|
||||||
bool stat(const std::string& path, stat_t& info);
|
bool get_stat(const std::string& path, stat_t& info);
|
||||||
|
|
||||||
// Check whether a file or a directory exists (not recommended, use is_file() or is_dir() instead)
|
// Check whether a file or a directory exists (not recommended, use is_file() or is_dir() instead)
|
||||||
bool exists(const std::string& path);
|
bool exists(const std::string& path);
|
||||||
|
@ -726,7 +726,7 @@ bool patch_engine::add_patch_data(YAML::Node node, patch_info& info, u32 modifie
|
|||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
const u32 offset = get_yaml_node_value<u32>(addr_node, error_message);
|
get_yaml_node_value<u32>(addr_node, error_message);
|
||||||
if (!error_message.empty())
|
if (!error_message.empty())
|
||||||
{
|
{
|
||||||
error_message = fmt::format("Skipping patch data entry: [ %s, 0x%.8x, %s ] (key: %s, location: %s) Invalid patch offset '%s' (not a valid u32 or overflow)",
|
error_message = fmt::format("Skipping patch data entry: [ %s, 0x%.8x, %s ] (key: %s, location: %s) Invalid patch offset '%s' (not a valid u32 or overflow)",
|
||||||
|
@ -155,7 +155,7 @@ error_code select_photo(std::string dst_dir)
|
|||||||
{
|
{
|
||||||
fs::stat_t f_info{};
|
fs::stat_t f_info{};
|
||||||
|
|
||||||
if (!fs::stat(info.path, f_info) || f_info.is_directory)
|
if (!fs::get_stat(info.path, f_info) || f_info.is_directory)
|
||||||
{
|
{
|
||||||
cellPhotoImportUtil.error("Path does not belong to a valid file: '%s'", info.path);
|
cellPhotoImportUtil.error("Path does not belong to a valid file: '%s'", info.path);
|
||||||
result = CELL_PHOTO_IMPORT_ERROR_ACCESS_ERROR; // TODO: is this correct ?
|
result = CELL_PHOTO_IMPORT_ERROR_ACCESS_ERROR; // TODO: is this correct ?
|
||||||
|
@ -1397,7 +1397,7 @@ static NEVER_INLINE error_code savedata_op(ppu_thread& ppu, u32 operation, u32 v
|
|||||||
}
|
}
|
||||||
|
|
||||||
fs::stat_t dir_info{};
|
fs::stat_t dir_info{};
|
||||||
if (!fs::stat(dir_path, dir_info))
|
if (!fs::get_stat(dir_path, dir_info))
|
||||||
{
|
{
|
||||||
// funcStat is called even if the directory doesn't exist.
|
// funcStat is called even if the directory doesn't exist.
|
||||||
}
|
}
|
||||||
@ -2099,7 +2099,7 @@ static NEVER_INLINE error_code savedata_get_list_item(vm::cptr<char> dirName, vm
|
|||||||
if (dir)
|
if (dir)
|
||||||
{
|
{
|
||||||
fs::stat_t dir_info{};
|
fs::stat_t dir_info{};
|
||||||
if (!fs::stat(save_path, dir_info))
|
if (!fs::get_stat(save_path, dir_info))
|
||||||
{
|
{
|
||||||
return CELL_SAVEDATA_ERROR_INTERNAL;
|
return CELL_SAVEDATA_ERROR_INTERNAL;
|
||||||
}
|
}
|
||||||
|
@ -1488,7 +1488,7 @@ error_code sys_fs_stat(ppu_thread& ppu, vm::cptr<char> path, vm::ptr<CellFsStat>
|
|||||||
|
|
||||||
fs::stat_t info{};
|
fs::stat_t info{};
|
||||||
|
|
||||||
if (!fs::stat(local_path, info))
|
if (!fs::get_stat(local_path, info))
|
||||||
{
|
{
|
||||||
switch (auto error = fs::g_tls_error)
|
switch (auto error = fs::g_tls_error)
|
||||||
{
|
{
|
||||||
@ -1499,7 +1499,7 @@ error_code sys_fs_stat(ppu_thread& ppu, vm::cptr<char> path, vm::ptr<CellFsStat>
|
|||||||
|
|
||||||
for (u32 i = 66601; i <= 66699; i++)
|
for (u32 i = 66601; i <= 66699; i++)
|
||||||
{
|
{
|
||||||
if (fs::stat(fmt::format("%s.%u", local_path, i), info) && !info.is_directory)
|
if (fs::get_stat(fmt::format("%s.%u", local_path, i), info) && !info.is_directory)
|
||||||
{
|
{
|
||||||
total_size += info.size;
|
total_size += info.size;
|
||||||
}
|
}
|
||||||
@ -1510,7 +1510,7 @@ error_code sys_fs_stat(ppu_thread& ppu, vm::cptr<char> path, vm::ptr<CellFsStat>
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Use attributes from the first fragment (consistently with sys_fs_open+fstat)
|
// Use attributes from the first fragment (consistently with sys_fs_open+fstat)
|
||||||
if (fs::stat(local_path + ".66600", info) && !info.is_directory)
|
if (fs::get_stat(local_path + ".66600", info) && !info.is_directory)
|
||||||
{
|
{
|
||||||
// Success
|
// Success
|
||||||
info.size += total_size;
|
info.size += total_size;
|
||||||
|
@ -296,12 +296,12 @@ namespace rsx
|
|||||||
|
|
||||||
// Writeback to cache either if file does not exist or it is invalid (unexpected size)
|
// Writeback to cache either if file does not exist or it is invalid (unexpected size)
|
||||||
// Note: fs::write_file is not atomic, if the process is terminated in the middle an empty file is created
|
// Note: fs::write_file is not atomic, if the process is terminated in the middle an empty file is created
|
||||||
if (fs::stat_t s{}; !fs::stat(fp_name, s) || s.size != fp.ucode_length)
|
if (fs::stat_t s{}; !fs::get_stat(fp_name, s) || s.size != fp.ucode_length)
|
||||||
{
|
{
|
||||||
fs::write_file(fp_name, fs::rewrite, fp.get_data(), fp.ucode_length);
|
fs::write_file(fp_name, fs::rewrite, fp.get_data(), fp.ucode_length);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fs::stat_t s{}; !fs::stat(vp_name, s) || s.size != vp.data.size() * sizeof(u32))
|
if (fs::stat_t s{}; !fs::get_stat(vp_name, s) || s.size != vp.data.size() * sizeof(u32))
|
||||||
{
|
{
|
||||||
fs::write_file(vp_name, fs::rewrite, vp.data);
|
fs::write_file(vp_name, fs::rewrite, vp.data);
|
||||||
}
|
}
|
||||||
|
@ -277,7 +277,7 @@ void Emulator::Init()
|
|||||||
const std::string cfg_path = fs::get_config_dir() + "/config.yml";
|
const std::string cfg_path = fs::get_config_dir() + "/config.yml";
|
||||||
|
|
||||||
// Save new global config if it doesn't exist or is empty
|
// Save new global config if it doesn't exist or is empty
|
||||||
if (fs::stat_t info{}; !fs::stat(cfg_path, info) || info.size == 0)
|
if (fs::stat_t info{}; !fs::get_stat(cfg_path, info) || info.size == 0)
|
||||||
{
|
{
|
||||||
Emulator::SaveSettings(g_cfg_defaults, {});
|
Emulator::SaveSettings(g_cfg_defaults, {});
|
||||||
}
|
}
|
||||||
|
@ -263,7 +263,7 @@ std::vector<u8> tar_object::save_directory(const std::string& src_dir, std::vect
|
|||||||
const std::string& target_path = full_path.empty() ? src_dir : full_path;
|
const std::string& target_path = full_path.empty() ? src_dir : full_path;
|
||||||
|
|
||||||
fs::stat_t stat{};
|
fs::stat_t stat{};
|
||||||
if (!fs::stat(target_path, stat))
|
if (!fs::get_stat(target_path, stat))
|
||||||
{
|
{
|
||||||
return std::move(init);
|
return std::move(init);
|
||||||
}
|
}
|
||||||
|
@ -2384,7 +2384,7 @@ void main_window::CreateConnects()
|
|||||||
fs::stat_t raw_stat{};
|
fs::stat_t raw_stat{};
|
||||||
fs::stat_t archived_stat{};
|
fs::stat_t archived_stat{};
|
||||||
|
|
||||||
if ((!fs::stat(raw_file_path, raw_stat) || raw_stat.is_directory) || (!fs::stat(archived_path, archived_stat) || archived_stat.is_directory) || (raw_stat.size == 0 && archived_stat.size == 0))
|
if ((!fs::get_stat(raw_file_path, raw_stat) || raw_stat.is_directory) || (!fs::get_stat(archived_path, archived_stat) || archived_stat.is_directory) || (raw_stat.size == 0 && archived_stat.size == 0))
|
||||||
{
|
{
|
||||||
QMessageBox::warning(this, tr("Failed to locate log"), tr("Failed to locate log files.\nMake sure that RPCS3.log and RPCS3.log.gz are writable and can be created without permission issues."));
|
QMessageBox::warning(this, tr("Failed to locate log"), tr("Failed to locate log files.\nMake sure that RPCS3.log and RPCS3.log.gz are writable and can be created without permission issues."));
|
||||||
return;
|
return;
|
||||||
|
Loading…
Reference in New Issue
Block a user