summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/core/file_sys/disk_archive.cpp11
-rw-r--r--src/core/file_sys/disk_archive.h2
2 files changed, 7 insertions, 6 deletions
diff --git a/src/core/file_sys/disk_archive.cpp b/src/core/file_sys/disk_archive.cpp
index 0197f727d..c6e033fcd 100644
--- a/src/core/file_sys/disk_archive.cpp
+++ b/src/core/file_sys/disk_archive.cpp
@@ -6,6 +6,7 @@
6 6
7#include "common/common_types.h" 7#include "common/common_types.h"
8#include "common/file_util.h" 8#include "common/file_util.h"
9#include "common/make_unique.h"
9 10
10#include "core/file_sys/disk_archive.h" 11#include "core/file_sys/disk_archive.h"
11#include "core/settings.h" 12#include "core/settings.h"
@@ -17,10 +18,10 @@ namespace FileSys {
17 18
18std::unique_ptr<FileBackend> DiskArchive::OpenFile(const Path& path, const Mode mode) const { 19std::unique_ptr<FileBackend> DiskArchive::OpenFile(const Path& path, const Mode mode) const {
19 LOG_DEBUG(Service_FS, "called path=%s mode=%01X", path.DebugStr().c_str(), mode.hex); 20 LOG_DEBUG(Service_FS, "called path=%s mode=%01X", path.DebugStr().c_str(), mode.hex);
20 DiskFile* file = new DiskFile(this, path, mode); 21 auto file = Common::make_unique<DiskFile>(this, path, mode);
21 if (!file->Open()) 22 if (!file->Open())
22 return nullptr; 23 return nullptr;
23 return std::unique_ptr<FileBackend>(file); 24 return std::move(file);
24} 25}
25 26
26bool DiskArchive::DeleteFile(const Path& path) const { 27bool DiskArchive::DeleteFile(const Path& path) const {
@@ -66,10 +67,10 @@ bool DiskArchive::RenameDirectory(const Path& src_path, const Path& dest_path) c
66 67
67std::unique_ptr<DirectoryBackend> DiskArchive::OpenDirectory(const Path& path) const { 68std::unique_ptr<DirectoryBackend> DiskArchive::OpenDirectory(const Path& path) const {
68 LOG_DEBUG(Service_FS, "called path=%s", path.DebugStr().c_str()); 69 LOG_DEBUG(Service_FS, "called path=%s", path.DebugStr().c_str());
69 DiskDirectory* directory = new DiskDirectory(this, path); 70 auto directory = Common::make_unique<DiskDirectory>(this, path);
70 if (!directory->Open()) 71 if (!directory->Open())
71 return nullptr; 72 return nullptr;
72 return std::unique_ptr<DirectoryBackend>(directory); 73 return std::move(directory);
73} 74}
74 75
75//////////////////////////////////////////////////////////////////////////////////////////////////// 76////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -100,7 +101,7 @@ bool DiskFile::Open() {
100 // Open the file in binary mode, to avoid problems with CR/LF on Windows systems 101 // Open the file in binary mode, to avoid problems with CR/LF on Windows systems
101 mode_string += "b"; 102 mode_string += "b";
102 103
103 file = new FileUtil::IOFile(path, mode_string.c_str()); 104 file = Common::make_unique<FileUtil::IOFile>(path, mode_string.c_str());
104 return true; 105 return true;
105} 106}
106 107
diff --git a/src/core/file_sys/disk_archive.h b/src/core/file_sys/disk_archive.h
index f18d96f5a..4663a9591 100644
--- a/src/core/file_sys/disk_archive.h
+++ b/src/core/file_sys/disk_archive.h
@@ -75,7 +75,7 @@ protected:
75 const DiskArchive* archive; 75 const DiskArchive* archive;
76 std::string path; 76 std::string path;
77 Mode mode; 77 Mode mode;
78 FileUtil::IOFile* file; 78 std::unique_ptr<FileUtil::IOFile> file;
79}; 79};
80 80
81class DiskDirectory : public DirectoryBackend { 81class DiskDirectory : public DirectoryBackend {