Skip to content

Commit

Permalink
#5108: Add VirtualFileSystem::getArchiveExtensions() method, list PK4…
Browse files Browse the repository at this point in the history
… files in MapSelector
  • Loading branch information
codereader committed Nov 17, 2020
1 parent b4a8a2e commit 58f9059
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 0 deletions.
3 changes: 3 additions & 0 deletions include/ifilesystem.h
Expand Up @@ -146,6 +146,9 @@ class VirtualFileSystem :
/// \brief Shuts down the filesystem.
virtual void shutdown() = 0;

// Returns the extension set this VFS instance has been initialised with
virtual const ExtensionSet& getArchiveExtensions() const = 0;

// greebo: Adds/removes observers to/from the VFS
virtual void addObserver(Observer& observer) = 0;
virtual void removeObserver(Observer& observer) = 0;
Expand Down
10 changes: 10 additions & 0 deletions radiant/ui/mapselector/MapSelector.cpp
@@ -1,7 +1,9 @@
#include "MapSelector.h"

#include "i18n.h"
#include "ifilesystem.h"

#include "string/case_conv.h"
#include <wx/sizer.h>
#include <wx/button.h>

Expand Down Expand Up @@ -90,6 +92,14 @@ void MapSelector::setupTreeView(wxWindow* parent)
fileExtensions.insert(pattern.extension);
}

// Add all PK extensions too
const auto& pakExtensions = GlobalFileSystem().getArchiveExtensions();

for (const auto& extension : pakExtensions)
{
fileExtensions.insert(string::to_lower_copy(extension));
}

_treeView->SetFileExtensions(fileExtensions);
}

Expand Down
5 changes: 5 additions & 0 deletions radiantcore/vfs/Doom3FileSystem.cpp
Expand Up @@ -352,6 +352,11 @@ void Doom3FileSystem::shutdown()
rMessage() << "Filesystem shut down" << std::endl;
}

const VirtualFileSystem::ExtensionSet& Doom3FileSystem::getArchiveExtensions() const
{
return _allowedExtensions;
}

void Doom3FileSystem::addObserver(Observer& observer)
{
_observers.insert(&observer);
Expand Down
2 changes: 2 additions & 0 deletions radiantcore/vfs/Doom3FileSystem.h
Expand Up @@ -34,6 +34,8 @@ class Doom3FileSystem :
void initialise(const SearchPaths& vfsSearchPaths, const ExtensionSet& allowedExtensions) override;
void shutdown() override;

const ExtensionSet& getArchiveExtensions() const override;

int getFileCount(const std::string& filename) override;
ArchiveFilePtr openFile(const std::string& filename) override;
ArchiveTextFilePtr openTextFile(const std::string& filename) override;
Expand Down

0 comments on commit 58f9059

Please sign in to comment.