]> de.git.xonotic.org Git - xonotic/netradiant.git/blobdiff - plugins/vfspk3/vfs.cpp
fixed crash loading quake4 1.3 entity definitions
[xonotic/netradiant.git] / plugins / vfspk3 / vfs.cpp
index 27a2987de0503532433c0bf1ff0d838311fe2b3d..cbe0812a554c10977078ba6f8bac40a05df292db 100644 (file)
@@ -57,6 +57,7 @@ ArchiveModules& FileSystemQ3API_getArchiveModules();
 
 #include "generic/callback.h"
 #include "string/string.h"
+#include "container/array.h"
 #include "stream/stringstream.h"
 #include "os/path.h"
 #include "moduleobservers.h"
@@ -141,7 +142,14 @@ static void InitPakFile (ArchiveModules& archiveModules, const char *filename)
   if(table != 0)
   {
     archive_entry_t entry;
-    entry.name = filename;
+
+    std::size_t length = string_length(filename);
+    Array<char> tmp(length + 2);
+    std::copy(filename, filename + length, tmp.begin());
+    tmp[length] = ':';
+    tmp[length + 1] = '\0';
+    entry.name = tmp.begin();
+
     entry.archive = table->m_pfnOpenArchive(filename);
     entry.is_pakfile = true;
     g_archives.push_back(entry);
@@ -520,7 +528,7 @@ const char* FindFile(const char* relative)
 {
   for(archives_t::iterator i = g_archives.begin(); i != g_archives.end(); ++i)
   {
-    if(!(*i).is_pakfile && (*i).archive->containsFile(relative))
+    if((*i).archive->containsFile(relative))
     {
       return (*i).name.c_str();
     }
@@ -533,7 +541,7 @@ const char* FindPath(const char* absolute)
 {
   for(archives_t::iterator i = g_archives.begin(); i != g_archives.end(); ++i)
   {
-    if(!(*i).is_pakfile && path_equal_n(absolute, (*i).name.c_str(), string_length((*i).name.c_str())))
+    if(path_equal_n(absolute, (*i).name.c_str(), string_length((*i).name.c_str())))
     {
       return (*i).name.c_str();
     }