From d7fa75ef640bc0c691e9a00c3433c3411dcf9a5c Mon Sep 17 00:00:00 2001
From: Felipe <felipe.v.b@icloud.com>
Date: Tue, 27 Oct 2020 18:31:05 -0400
Subject: [PATCH] modify file export to create folder in OS when explicitly
 extracting a directory

---
 Source/Core/DiscIO/DiscExtractor.cpp | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/Source/Core/DiscIO/DiscExtractor.cpp b/Source/Core/DiscIO/DiscExtractor.cpp
index a68093aca9..225302bb9c 100644
--- a/Source/Core/DiscIO/DiscExtractor.cpp
+++ b/Source/Core/DiscIO/DiscExtractor.cpp
@@ -130,13 +130,15 @@ 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)
 {
-  File::CreateFullPath(export_folder + '/');
+  const std::string export_root =
+      export_folder + (directory.IsDirectory() ? "/" + directory.GetName() + "/" : "/");
+  File::CreateFullPath(export_root);
 
   for (const FileInfo& file_info : directory)
   {
     const std::string name = file_info.GetName() + (file_info.IsDirectory() ? "/" : "");
     const std::string path = filesystem_path + name;
-    const std::string export_path = export_folder + '/' + name;
+    const std::string export_path = export_root + name;
 
     if (update_progress(path))
       return;