delete save file before restoring. always commit fs after every write + close, delete, rename, create.

This commit is contained in:
ITotalJustice
2025-06-17 01:57:42 +01:00
parent b405a816c9
commit 0789a69975
5 changed files with 61 additions and 27 deletions

View File

@@ -199,6 +199,7 @@ struct File {
FsFile m_native{};
std::FILE* m_stdio{};
s64 m_stdio_off{};
u32 m_mode{};
};
struct Dir {
@@ -287,6 +288,7 @@ struct Fs {
virtual Result GetEntryType(const FsPath& path, FsDirEntryType* out) = 0;
virtual Result GetFileTimeStampRaw(const FsPath& path, FsTimeStampRaw *out) = 0;
virtual Result SetTimestamp(const FsPath& path, const FsTimeStampRaw* ts) = 0;
virtual Result Commit() = 0;
virtual bool FileExists(const FsPath& path) = 0;
virtual bool DirExists(const FsPath& path) = 0;
virtual bool IsNative() const = 0;
@@ -362,6 +364,9 @@ struct FsStdio : Fs {
Result SetTimestamp(const FsPath& path, const FsTimeStampRaw *ts) override {
return fs::SetTimestamp(path, ts);
}
Result Commit() override {
R_SUCCEED();
}
bool FileExists(const FsPath& path) override {
return fs::FileExists(path);
}
@@ -397,10 +402,6 @@ struct FsNative : Fs {
}
}
Result Commit() {
return fsFsCommit(&m_fs);
}
Result GetFreeSpace(const FsPath& path, s64* out) {
return fsFsGetFreeSpace(&m_fs, path, out);
}
@@ -453,6 +454,9 @@ struct FsNative : Fs {
Result SetTimestamp(const FsPath& path, const FsTimeStampRaw *ts) override {
return fs::SetTimestamp(&m_fs, path, ts);
}
Result Commit() override {
return fsFsCommit(&m_fs);
}
bool FileExists(const FsPath& path) override {
return fs::FileExists(&m_fs, path);
}