mirror of
https://github.com/yuzu-emu/yuzu.git
synced 2025-06-11 18:48:01 -05:00
Merge pull request #2132 from wwylele/fix-fs-err
Correct FS error codes & add path boundary checks
This commit is contained in:
@ -360,7 +360,7 @@ ResultCode CreateConfigInfoBlk(u32 block_id, u16 size, u16 flags, const void* da
|
||||
}
|
||||
|
||||
ResultCode DeleteConfigNANDSaveFile() {
|
||||
FileSys::Path path("config");
|
||||
FileSys::Path path("/config");
|
||||
return Service::FS::DeleteFileFromArchive(cfg_system_save_data_archive, path);
|
||||
}
|
||||
|
||||
@ -369,7 +369,7 @@ ResultCode UpdateConfigNANDSavegame() {
|
||||
mode.write_flag.Assign(1);
|
||||
mode.create_flag.Assign(1);
|
||||
|
||||
FileSys::Path path("config");
|
||||
FileSys::Path path("/config");
|
||||
|
||||
auto config_result = Service::FS::OpenFileFromArchive(cfg_system_save_data_archive, path, mode);
|
||||
ASSERT_MSG(config_result.Succeeded(), "could not open file");
|
||||
@ -383,8 +383,9 @@ ResultCode UpdateConfigNANDSavegame() {
|
||||
ResultCode FormatConfig() {
|
||||
ResultCode res = DeleteConfigNANDSaveFile();
|
||||
// The delete command fails if the file doesn't exist, so we have to check that too
|
||||
if (!res.IsSuccess() && res.description != ErrorDescription::FS_NotFound)
|
||||
if (!res.IsSuccess() && res.description != ErrorDescription::FS_FileNotFound) {
|
||||
return res;
|
||||
}
|
||||
// Delete the old data
|
||||
cfg_config_file_buffer.fill(0);
|
||||
// Create the header
|
||||
@ -510,7 +511,7 @@ ResultCode LoadConfigNANDSaveFile() {
|
||||
|
||||
cfg_system_save_data_archive = *archive_result;
|
||||
|
||||
FileSys::Path config_path("config");
|
||||
FileSys::Path config_path("/config");
|
||||
FileSys::Mode open_mode = {};
|
||||
open_mode.read_flag.Assign(1);
|
||||
|
||||
|
Reference in New Issue
Block a user