diff options
| author | JosJuice <josjuice@gmail.com> | 2020-12-03 20:59:45 +0100 |
|---|---|---|
| committer | JosJuice <josjuice@gmail.com> | 2020-12-03 21:13:53 +0100 |
| commit | b43f7c85cc8a5553382b048c83ff83f50fb34c8b (patch) | |
| tree | d44140d94e566b196df92d1309a270f0f4a8b5ea /Source/Core/DiscIO | |
| parent | 5abae61a8c7e0e4ac03bb8d3031793037e87fdd3 (diff) | |
DiscIO: Fix recursive directory extraction
https://bugs.dolphin-emu.org/issues/12331
Diffstat (limited to 'Source/Core/DiscIO')
| -rw-r--r-- | Source/Core/DiscIO/DiscExtractor.cpp | 9 | ||||
| -rw-r--r-- | Source/Core/DiscIO/FileSystemGCWii.cpp | 5 | ||||
| -rw-r--r-- | Source/Core/DiscIO/FileSystemGCWii.h | 1 | ||||
| -rw-r--r-- | Source/Core/DiscIO/Filesystem.h | 1 |
4 files changed, 13 insertions, 3 deletions
diff --git a/Source/Core/DiscIO/DiscExtractor.cpp b/Source/Core/DiscIO/DiscExtractor.cpp index 225302bb9c..acf692a4f4 100644 --- a/Source/Core/DiscIO/DiscExtractor.cpp +++ b/Source/Core/DiscIO/DiscExtractor.cpp @@ -130,8 +130,10 @@ void ExportDirectory(const Volume& volume, const Partition& partition, const Fil const std::string& export_folder, const std::function<bool(const std::string& path)>& update_progress) { - const std::string export_root = - export_folder + (directory.IsDirectory() ? "/" + directory.GetName() + "/" : "/"); + std::string export_root = export_folder + '/'; + if (directory.IsDirectory() && !directory.IsRoot()) + export_root += directory.GetName() + '/'; + File::CreateFullPath(export_root); for (const FileInfo& file_info : directory) @@ -154,7 +156,8 @@ void ExportDirectory(const Volume& volume, const Partition& partition, const Fil } else if (recursive) { - ExportDirectory(volume, partition, file_info, recursive, path, export_path, update_progress); + ExportDirectory(volume, partition, file_info, recursive, filesystem_path, export_root, + update_progress); } } } diff --git a/Source/Core/DiscIO/FileSystemGCWii.cpp b/Source/Core/DiscIO/FileSystemGCWii.cpp index 541baf67ee..40b15d3715 100644 --- a/Source/Core/DiscIO/FileSystemGCWii.cpp +++ b/Source/Core/DiscIO/FileSystemGCWii.cpp @@ -96,6 +96,11 @@ u64 FileInfoGCWii::GetOffset() const return static_cast<u64>(Get(EntryProperty::FILE_OFFSET)) << m_offset_shift; } +bool FileInfoGCWii::IsRoot() const +{ + return m_index == 0; +} + bool FileInfoGCWii::IsDirectory() const { return (Get(EntryProperty::NAME_OFFSET) & 0xFF000000) != 0; diff --git a/Source/Core/DiscIO/FileSystemGCWii.h b/Source/Core/DiscIO/FileSystemGCWii.h index 8f56c7620f..b6ad257ea9 100644 --- a/Source/Core/DiscIO/FileSystemGCWii.h +++ b/Source/Core/DiscIO/FileSystemGCWii.h @@ -42,6 +42,7 @@ public: u64 GetOffset() const override; u32 GetSize() const override; + bool IsRoot() const override; bool IsDirectory() const override; u32 GetTotalChildren() const override; std::string GetName() const override; diff --git a/Source/Core/DiscIO/Filesystem.h b/Source/Core/DiscIO/Filesystem.h index 35b01e17b1..0d87c9a4e6 100644 --- a/Source/Core/DiscIO/Filesystem.h +++ b/Source/Core/DiscIO/Filesystem.h @@ -89,6 +89,7 @@ public: virtual u32 GetSize() const = 0; // For a file, returns its size. For a directory, returns the total size of its contents. u64 GetTotalSize() const; + virtual bool IsRoot() const = 0; virtual bool IsDirectory() const = 0; // The number of files and directories in a directory, including those in subdirectories. // Not guaranteed to return a meaningful value for files. |
