mirror of
https://github.com/vcmi/vcmi.git
synced 2025-07-15 01:24:45 +02:00
fix crash when map is packaged in a zip mod
This commit is contained in:
@ -11,6 +11,7 @@
|
||||
#include "CZipLoader.h"
|
||||
|
||||
#include "../ScopeGuard.h"
|
||||
#include "../texts/TextOperations.h"
|
||||
|
||||
VCMI_LIB_NAMESPACE_BEGIN
|
||||
|
||||
@ -120,6 +121,19 @@ std::unordered_set<ResourcePath> CZipLoader::getFilteredFiles(std::function<bool
|
||||
return foundID;
|
||||
}
|
||||
|
||||
std::string CZipLoader::getFullFileURI(const ResourcePath& resourceName) const
|
||||
{
|
||||
auto relativePath = TextOperations::Utf8TofilesystemPath(resourceName.getName());
|
||||
auto path = boost::filesystem::canonical(archiveName) / relativePath;
|
||||
return TextOperations::filesystemPathToUtf8(path);
|
||||
}
|
||||
|
||||
std::time_t CZipLoader::getLastWriteTime(const ResourcePath& resourceName) const
|
||||
{
|
||||
auto path = boost::filesystem::canonical(archiveName);
|
||||
return boost::filesystem::last_write_time(path);
|
||||
}
|
||||
|
||||
/// extracts currently selected file from zip into stream "where"
|
||||
static bool extractCurrent(unzFile file, std::ostream & where)
|
||||
{
|
||||
|
Reference in New Issue
Block a user