summaryrefslogtreecommitdiff
path: root/src/fs/virtfs/fszip.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2017-05-16 19:04:21 +0300
committerAndrei Karas <akaras@inbox.ru>2017-05-16 19:04:21 +0300
commitba71181d5e6fd35083a9e7a86c8e1a9592581398 (patch)
tree9c2751255c652aa444a61a083648537fd9177a41 /src/fs/virtfs/fszip.cpp
parent873eff85f179593d486793be24b3cfaf73226e1f (diff)
downloadmv-ba71181d5e6fd35083a9e7a86c8e1a9592581398.tar.gz
mv-ba71181d5e6fd35083a9e7a86c8e1a9592581398.tar.bz2
mv-ba71181d5e6fd35083a9e7a86c8e1a9592581398.tar.xz
mv-ba71181d5e6fd35083a9e7a86c8e1a9592581398.zip
Add subdir support in VirtFs::getFilesWithDir.
Diffstat (limited to 'src/fs/virtfs/fszip.cpp')
-rw-r--r--src/fs/virtfs/fszip.cpp14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/fs/virtfs/fszip.cpp b/src/fs/virtfs/fszip.cpp
index cc720f626..068b7ee45 100644
--- a/src/fs/virtfs/fszip.cpp
+++ b/src/fs/virtfs/fszip.cpp
@@ -317,7 +317,13 @@ namespace FsZip
StringVect &names)
{
ZipEntry *const zipEntry = static_cast<ZipEntry*>(entry);
- if (dirName == dirSeparator)
+ const std::string subDir = zipEntry->subDir;
+ std::string dirNameFull;
+ if (subDir != dirSeparator)
+ dirNameFull = pathJoin(subDir, dirName);
+ else
+ dirNameFull = dirName;
+ if (dirNameFull == dirSeparator)
{
FOR_EACH (std::vector<ZipLocalHeader*>::const_iterator,
it2,
@@ -340,7 +346,7 @@ namespace FsZip
}
if (found == false)
{
- std::string dirName2 = pathJoin(dirName, fileName);
+ std::string dirName2 = pathJoin(dirNameFull, fileName);
if (findLast(dirName2, std::string(dirSeparator)) == false)
dirName2 += dirSeparator;
FOR_EACH (std::vector<std::string>::const_iterator,
@@ -366,7 +372,7 @@ namespace FsZip
{
ZipLocalHeader *const header = *it2;
std::string fileName = header->fileName;
- if (findCutFirst(fileName, dirName) == true)
+ if (findCutFirst(fileName, dirNameFull) == true)
{
// skip subdirs from enumeration
const size_t idx = fileName.find(dirSeparator);
@@ -383,7 +389,7 @@ namespace FsZip
}
if (found == false)
{
- std::string dirName2 = pathJoin(dirName, fileName);
+ std::string dirName2 = pathJoin(dirNameFull, fileName);
if (findLast(dirName2, std::string(dirSeparator)) ==
false)
{