diff options
| -rw-r--r-- | src/core/file_sys/vfs_real.cpp | 11 | ||||
| -rw-r--r-- | src/core/file_sys/vfs_real.h | 3 |
2 files changed, 3 insertions, 11 deletions
diff --git a/src/core/file_sys/vfs_real.cpp b/src/core/file_sys/vfs_real.cpp index a63629b80..d16790b55 100644 --- a/src/core/file_sys/vfs_real.cpp +++ b/src/core/file_sys/vfs_real.cpp | |||
| @@ -75,16 +75,9 @@ VfsEntryType RealVfsFilesystem::GetEntryType(std::string_view path_) const { | |||
| 75 | VirtualFile RealVfsFilesystem::OpenFile(std::string_view path_, Mode perms) { | 75 | VirtualFile RealVfsFilesystem::OpenFile(std::string_view path_, Mode perms) { |
| 76 | const auto path = FS::SanitizePath(path_, FS::DirectorySeparator::PlatformDefault); | 76 | const auto path = FS::SanitizePath(path_, FS::DirectorySeparator::PlatformDefault); |
| 77 | 77 | ||
| 78 | this->EvictSingleReference(); | 78 | auto reference = std::make_unique<FileReference>(); |
| 79 | |||
| 80 | auto backing = FS::FileOpen(path, ModeFlagsToFileAccessMode(perms), FS::FileType::BinaryFile); | ||
| 81 | if (!backing) { | ||
| 82 | return nullptr; | ||
| 83 | } | ||
| 84 | |||
| 85 | num_open_files++; | ||
| 86 | auto reference = std::make_unique<FileReference>(std::move(backing)); | ||
| 87 | this->InsertReferenceIntoList(*reference); | 79 | this->InsertReferenceIntoList(*reference); |
| 80 | |||
| 88 | return std::shared_ptr<RealVfsFile>(new RealVfsFile(*this, std::move(reference), path, perms)); | 81 | return std::shared_ptr<RealVfsFile>(new RealVfsFile(*this, std::move(reference), path, perms)); |
| 89 | } | 82 | } |
| 90 | 83 | ||
diff --git a/src/core/file_sys/vfs_real.h b/src/core/file_sys/vfs_real.h index f29c69fbd..48dc2698a 100644 --- a/src/core/file_sys/vfs_real.h +++ b/src/core/file_sys/vfs_real.h | |||
| @@ -15,8 +15,7 @@ class IOFile; | |||
| 15 | namespace FileSys { | 15 | namespace FileSys { |
| 16 | 16 | ||
| 17 | struct FileReference : public Common::IntrusiveListBaseNode<FileReference> { | 17 | struct FileReference : public Common::IntrusiveListBaseNode<FileReference> { |
| 18 | FileReference(std::shared_ptr<Common::FS::IOFile>&& f) : file(f) {} | 18 | std::shared_ptr<Common::FS::IOFile> file{}; |
| 19 | std::shared_ptr<Common::FS::IOFile> file; | ||
| 20 | }; | 19 | }; |
| 21 | 20 | ||
| 22 | class RealVfsFile; | 21 | class RealVfsFile; |