diff options
| author | Subv <subv2112@gmail.com> | 2018-03-21 09:36:26 -0500 |
|---|---|---|
| committer | Subv <subv2112@gmail.com> | 2018-03-21 09:55:59 -0500 |
| commit | eff3f60b73343365ad65638f55591965df6f7e25 (patch) | |
| tree | 9b2d61666ff0f516b06d3a6cfda144afb5fb72e7 /src/core/file_sys/disk_filesystem.cpp | |
| parent | 0485ee499f9e00fb2ec1926876d6e50c9b22447b (diff) | |
FS: Implemented IFileSystem::CreateDirectory.
Diffstat (limited to 'src/core/file_sys/disk_filesystem.cpp')
| -rw-r--r-- | src/core/file_sys/disk_filesystem.cpp | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/core/file_sys/disk_filesystem.cpp b/src/core/file_sys/disk_filesystem.cpp index f620b7961..9383bf856 100644 --- a/src/core/file_sys/disk_filesystem.cpp +++ b/src/core/file_sys/disk_filesystem.cpp @@ -18,7 +18,7 @@ std::string Disk_FileSystem::GetName() const { ResultVal<std::unique_ptr<StorageBackend>> Disk_FileSystem::OpenFile(const std::string& path, Mode mode) const { - std::string mode_str = ""; + std::string mode_str; u32 mode_flags = static_cast<u32>(mode); // Calculate the correct open mode for the file. @@ -95,8 +95,15 @@ ResultCode Disk_FileSystem::CreateFile(const std::string& path, u64 size) const return ResultCode(-1); } -ResultCode Disk_FileSystem::CreateDirectory(const Path& path) const { - LOG_WARNING(Service_FS, "(STUBBED) called"); +ResultCode Disk_FileSystem::CreateDirectory(const std::string& path) const { + // TODO(Subv): Perform path validation to prevent escaping the emulator sandbox. + std::string full_path = base_directory + path; + + if (FileUtil::CreateDir(full_path)) { + return RESULT_SUCCESS; + } + + LOG_CRITICAL(Service_FS, "(unreachable) Unknown error creating %s", full_path.c_str()); // TODO(wwylele): Use correct error code return ResultCode(-1); } |
