diff options
Diffstat (limited to 'src/core/file_sys')
-rw-r--r-- | src/core/file_sys/archive.h | 7 | ||||
-rw-r--r-- | src/core/file_sys/archive_romfs.cpp | 10 | ||||
-rw-r--r-- | src/core/file_sys/archive_romfs.h | 7 | ||||
-rw-r--r-- | src/core/file_sys/archive_sdmc.cpp | 9 | ||||
-rw-r--r-- | src/core/file_sys/archive_sdmc.h | 7 |
5 files changed, 40 insertions, 0 deletions
diff --git a/src/core/file_sys/archive.h b/src/core/file_sys/archive.h index 560db6dea..aeabf09ac 100644 --- a/src/core/file_sys/archive.h +++ b/src/core/file_sys/archive.h @@ -57,6 +57,13 @@ public: virtual std::unique_ptr<File> OpenFile(const std::string& path, const Mode mode) const = 0; /** + * Create a directory specified by its path + * @param path Path relative to the archive + * @return Whether the directory could be created + */ + virtual bool CreateDirectory(const std::string& path) const = 0; + + /** * Open a directory specified by its path * @param path Path relative to the archive * @return Opened directory, or nullptr diff --git a/src/core/file_sys/archive_romfs.cpp b/src/core/file_sys/archive_romfs.cpp index f101fc729..cc759faa8 100644 --- a/src/core/file_sys/archive_romfs.cpp +++ b/src/core/file_sys/archive_romfs.cpp @@ -34,6 +34,16 @@ std::unique_ptr<File> Archive_RomFS::OpenFile(const std::string& path, const Mod } /** + * Create a directory specified by its path + * @param path Path relative to the archive + * @return Whether the directory could be created + */ +bool Archive_RomFS::CreateDirectory(const std::string& path) const { + ERROR_LOG(FILESYS, "Attempted to create a directory in ROMFS."); + return false; +}; + +/** * Open a directory specified by its path * @param path Path relative to the archive * @return Opened directory, or nullptr diff --git a/src/core/file_sys/archive_romfs.h b/src/core/file_sys/archive_romfs.h index fcdefa95f..ae2344e82 100644 --- a/src/core/file_sys/archive_romfs.h +++ b/src/core/file_sys/archive_romfs.h @@ -37,6 +37,13 @@ public: std::unique_ptr<File> OpenFile(const std::string& path, const Mode mode) const override; /** + * Create a directory specified by its path + * @param path Path relative to the archive + * @return Whether the directory could be created + */ + bool CreateDirectory(const std::string& path) const override; + + /** * Open a directory specified by its path * @param path Path relative to the archive * @return Opened directory, or nullptr diff --git a/src/core/file_sys/archive_sdmc.cpp b/src/core/file_sys/archive_sdmc.cpp index 0b647f7d0..66931e93e 100644 --- a/src/core/file_sys/archive_sdmc.cpp +++ b/src/core/file_sys/archive_sdmc.cpp @@ -58,6 +58,15 @@ std::unique_ptr<File> Archive_SDMC::OpenFile(const std::string& path, const Mode } /** + * Create a directory specified by its path + * @param path Path relative to the archive + * @return Whether the directory could be created + */ +bool Archive_SDMC::CreateDirectory(const std::string& path) const { + return FileUtil::CreateDir(GetMountPoint() + path); +} + +/** * Open a directory specified by its path * @param path Path relative to the archive * @return Opened directory, or nullptr diff --git a/src/core/file_sys/archive_sdmc.h b/src/core/file_sys/archive_sdmc.h index f68648e6f..0e059b635 100644 --- a/src/core/file_sys/archive_sdmc.h +++ b/src/core/file_sys/archive_sdmc.h @@ -41,6 +41,13 @@ public: std::unique_ptr<File> OpenFile(const std::string& path, const Mode mode) const override; /** + * Create a directory specified by its path + * @param path Path relative to the archive + * @return Whether the directory could be created + */ + bool CreateDirectory(const std::string& path) const override; + + /** * Open a directory specified by its path * @param path Path relative to the archive * @return Opened directory, or nullptr |