mirror of
https://github.com/yuzu-emu/yuzu.git
synced 2024-09-15 00:55:33 +00:00
FileSys: w->rw permission lift only happens in SDMC archive
This commit is contained in:
parent
0987783699
commit
0647f86649
@ -19,6 +19,17 @@ namespace FileSys {
|
||||
|
||||
ResultVal<std::unique_ptr<FileBackend>> SDMCArchive::OpenFile(const Path& path,
|
||||
const Mode& mode) const {
|
||||
Mode modified_mode;
|
||||
modified_mode.hex = mode.hex;
|
||||
|
||||
// SDMC archive always opens a file with at least read permission
|
||||
modified_mode.read_flag.Assign(1);
|
||||
|
||||
return OpenFileBase(path, modified_mode);
|
||||
}
|
||||
|
||||
ResultVal<std::unique_ptr<FileBackend>> SDMCArchive::OpenFileBase(const Path& path,
|
||||
const Mode& mode) const {
|
||||
LOG_DEBUG(Service_FS, "called path=%s mode=%01X", path.DebugStr().c_str(), mode.hex);
|
||||
|
||||
const PathParser path_parser(path);
|
||||
|
@ -36,6 +36,7 @@ public:
|
||||
u64 GetFreeBytes() const override;
|
||||
|
||||
protected:
|
||||
ResultVal<std::unique_ptr<FileBackend>> OpenFileBase(const Path& path, const Mode& mode) const;
|
||||
std::string mount_point;
|
||||
};
|
||||
|
||||
|
@ -21,7 +21,7 @@ ResultVal<std::unique_ptr<FileBackend>> SDMCWriteOnlyArchive::OpenFile(const Pat
|
||||
LOG_ERROR(Service_FS, "Read flag is not supported");
|
||||
return ERROR_INVALID_READ_FLAG;
|
||||
}
|
||||
return SDMCArchive::OpenFile(path, mode);
|
||||
return SDMCArchive::OpenFileBase(path, mode);
|
||||
}
|
||||
|
||||
ResultVal<std::unique_ptr<DirectoryBackend>> SDMCWriteOnlyArchive::OpenDirectory(
|
||||
|
@ -163,7 +163,7 @@ u64 DiskArchive::GetFreeBytes() const {
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
ResultVal<size_t> DiskFile::Read(const u64 offset, const size_t length, u8* buffer) const {
|
||||
if (!mode.read_flag && !mode.write_flag)
|
||||
if (!mode.read_flag)
|
||||
return ResultCode(ErrorDescription::FS_InvalidOpenFlags, ErrorModule::FS,
|
||||
ErrorSummary::Canceled, ErrorLevel::Status);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user