Skip to content

Commit 8fa3b2c

Browse files
bhamonigrr
authored andcommitted
Add recursive sub-directories creation support.
1 parent 814bb23 commit 8fa3b2c

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

main.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -364,10 +364,10 @@ bool unpackFiles(std::string sDest) {
364364
if ((int)(it->type) == 1) {
365365
std::string name = (const char*)(it->name);
366366
std::string sDestFilePath = sDest + name;
367-
size_t pos = name.find_last_of("/");
367+
size_t pos = name.find_first_of("/", 1);
368368

369-
// If file is in sub directory?
370-
if (pos != std::string::npos) {
369+
// If file is in sub directories?
370+
while (pos != std::string::npos) {
371371
// Subdir path.
372372
std::string path = sDest;
373373
path += name.substr(0, pos);
@@ -378,6 +378,8 @@ bool unpackFiles(std::string sDest) {
378378
return false;
379379
}
380380
}
381+
382+
pos = name.find_first_of("/", pos + 1);
381383
}
382384

383385
// Unpack file to destination directory.

0 commit comments

Comments
 (0)