From aca003f4928768be037955fdb2b463782cd7bcdd Mon Sep 17 00:00:00 2001 From: "Felix A. Croes" <felix@dworkin.nl> Date: Wed, 29 Sep 2021 10:49:52 +0200 Subject: [PATCH] Extract single files with full path. So that identical files in different directories can be extracted without overwriting one another. --- src/Archive.hh | 1 - src/msiArchiveExtract.cc | 13 ++++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/Archive.hh b/src/Archive.hh index 8c3b70e..16c33f3 100644 --- a/src/Archive.hh +++ b/src/Archive.hh @@ -367,7 +367,6 @@ public: */ memset(&collCreateInp, '\0', sizeof(collInp_t)); rstrcpy(collCreateInp.collName, filename.c_str(), MAX_NAME_LEN); - addKeyVal(&collCreateInp.condInput, RECURSIVE_OPR__KW, ""); return rsCollCreate(data->rsComm, &collCreateInp); } else { char buf[A_BUFSIZE]; diff --git a/src/msiArchiveExtract.cc b/src/msiArchiveExtract.cc index c680656..1e46d33 100644 --- a/src/msiArchiveExtract.cc +++ b/src/msiArchiveExtract.cc @@ -194,7 +194,18 @@ int msiArchiveExtract(msParam_t* archiveIn, std::string::size_type found = file.rfind("/"); if (found != std::string::npos) { - file = file.substr(found + 1); + collInp_t collCreateInp; + + /* + * extract in collection + */ + memset(&collCreateInp, '\0', sizeof(collInp_t)); + rstrcpy(collCreateInp.collName, + (path + "/" + file.substr(0, found)).c_str(), + MAX_NAME_LEN); + addKeyVal(&collCreateInp.condInput, RECURSIVE_OPR__KW, + ""); + rsCollCreate(rei->rsComm, &collCreateInp); } } file = path + "/" + file; -- GitLab