modify file export to create folder in OS when explicitly extracting a directory

This commit is contained in:
Felipe 2020-10-27 18:31:05 -04:00
parent fe727ed1d0
commit d7fa75ef64
1 changed files with 4 additions and 2 deletions

View File

@ -130,13 +130,15 @@ void ExportDirectory(const Volume& volume, const Partition& partition, const Fil
const std::string& export_folder, const std::string& export_folder,
const std::function<bool(const std::string& path)>& update_progress) 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) for (const FileInfo& file_info : directory)
{ {
const std::string name = file_info.GetName() + (file_info.IsDirectory() ? "/" : ""); const std::string name = file_info.GetName() + (file_info.IsDirectory() ? "/" : "");
const std::string path = filesystem_path + name; 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)) if (update_progress(path))
return; return;