aboutsummaryrefslogtreecommitdiff
path: root/src/Archive.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/Archive.cpp')
-rw-r--r--src/Archive.cpp8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/Archive.cpp b/src/Archive.cpp
index 08106c3..6455df2 100644
--- a/src/Archive.cpp
+++ b/src/Archive.cpp
@@ -75,8 +75,6 @@ namespace sibs
flags |= ARCHIVE_EXTRACT_ACL;
flags |= ARCHIVE_EXTRACT_FFLAGS;
- FileString rootName;
-
a = archive_read_new();
archive_read_support_format_all(a);
archive_read_support_compression_all(a);
@@ -115,11 +113,11 @@ namespace sibs
}
const _tinydir_char_t* currentFile = archive_entry_pathname_native(entry);
- if(rootName.empty())
- rootName = currentFile;
FileString fullOutputPath = destination;
- fullOutputPath += (currentFile + (rootName.empty() ? 0 : rootName.size() - 1));
+ if(!fullOutputPath.empty() && fullOutputPath.back() != '/')
+ fullOutputPath += '/';
+ fullOutputPath += currentFile;
// TODO: Verify if this really works. Why doesn't libarchive have wide string version of archive_entry_set_pathname?
string fullOutputPathUtf8 = toUtf8(fullOutputPath);
archive_entry_set_pathname(entry, fullOutputPathUtf8.c_str());