Skip to content

Commit

Permalink
Fix #4570: display folders in entity selector and sound chooser are c…
Browse files Browse the repository at this point in the history
…luttered with PK4 top level nodes when DR is just pointed just to the TDM root path.
  • Loading branch information
codereader committed Jul 16, 2017
1 parent 17174ac commit d700acf
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
14 changes: 9 additions & 5 deletions plugins/archivezip/ZipArchive.cpp
Expand Up @@ -5,18 +5,22 @@

#include "pkzip.h"
#include "zlibstream.h"
#include "os/fs.h"
#include "os/path.h"

#include "DeflatedArchiveFile.h"
#include "DeflatedArchiveTextFile.h"

ZipArchive::ZipArchive(const std::string& name) :
m_name(name),
_containingFolder(os::standardPathWithSlash(fs::path(name).remove_filename())),
m_istream(name)
{
if (!m_istream.failed()) {
if (!read_pkzip()) {
rError() << "ERROR: invalid zip-file " << name.c_str() << '\n';
if (!m_istream.failed())
{
if (!read_pkzip())
{
rError() << "ERROR: invalid zip-file " << name << std::endl;
}
}
}
Expand Down Expand Up @@ -99,14 +103,14 @@ ArchiveTextFilePtr ZipArchive::openTextFile(const std::string& name)
case ZipRecord::eStored:
return ArchiveTextFilePtr(new StoredArchiveTextFile(name,
m_name,
m_name,
_containingFolder,
m_istream.tell(),
file->m_stream_size));

case ZipRecord::eDeflated:
return ArchiveTextFilePtr(new DeflatedArchiveTextFile(name,
m_name,
m_name,
_containingFolder,
m_istream.tell(),
file->m_stream_size));
}
Expand Down
3 changes: 2 additions & 1 deletion plugins/archivezip/ZipArchive.h
Expand Up @@ -34,7 +34,8 @@ class ZipArchive :
public Archive
{
ZipFileSystem m_filesystem;
std::string m_name;
std::string m_name; // the full path to this Zip
std::string _containingFolder; // the folder this Zip is located in
FileInputStream m_istream;
std::mutex _streamLock;

Expand Down

0 comments on commit d700acf

Please sign in to comment.