kernel: allow renaming open save files

This commit is contained in:
nmzik
2026-08-16 02:19:35 +02:00
parent 4f1bc505cc
commit 6e82c376f6
3 changed files with 112 additions and 7 deletions
+6 -7
View File
@@ -43,7 +43,7 @@ public:
};
MountPoints() { EXIT_NOT_IMPLEMENTED(!Common::Thread::IsMainThread()); }
virtual ~MountPoints() { KYTY_NOT_IMPLEMENTED; }
virtual ~MountPoints() = default;
KYTY_CLASS_NO_COPY(MountPoints);
@@ -76,7 +76,7 @@ struct File {
class FileDescriptors {
public:
FileDescriptors() { EXIT_NOT_IMPLEMENTED(!Common::Thread::IsMainThread()); }
virtual ~FileDescriptors() { KYTY_NOT_IMPLEMENTED; }
virtual ~FileDescriptors() = default;
KYTY_CLASS_NO_COPY(FileDescriptors);
@@ -193,8 +193,10 @@ void FileDescriptors::CloseAll() {
Common::LockGuard lock(m_mutex);
for (auto& f: m_files) {
if (f != nullptr && f->opened) {
f->f.Close();
if (f != nullptr) {
if (f->opened) {
f->f.Close();
}
delete f;
f = nullptr;
}
@@ -1054,9 +1056,6 @@ int KYTY_SYSV_ABI KernelRename(const char* from, const char* to) {
auto real_from = g_mount_points->GetRealFilename(from_path);
auto real_to = g_mount_points->GetRealFilename(to_path);
EXIT_NOT_IMPLEMENTED(g_files->GetFile(real_from) != nullptr);
EXIT_NOT_IMPLEMENTED(g_files->GetFile(real_to) != nullptr);
if (!Common::File::IsFileExisting(real_from)) {
return KERNEL_ERROR_ENOENT;
}