]> git.xonotic.org Git - voretournament/voretournament.git/blobdiff - misc/source/netradiant-src/plugins/vfspk3/vfs.cpp
Latest fteqcc and netradiant sources
[voretournament/voretournament.git] / misc / source / netradiant-src / plugins / vfspk3 / vfs.cpp
index b47942ba9149e2394fdaafc35cc2783b47c26902..86a2ac85f4cead9909bd9a033ac73e255fb1f4ed 100644 (file)
@@ -60,6 +60,7 @@ ArchiveModules& FileSystemQ3API_getArchiveModules();
 #include "stream/stringstream.h"
 #include "os/path.h"
 #include "moduleobservers.h"
+#include "filematch.h"
 
 
 #define VFS_MAXDIRS 64
@@ -315,9 +316,17 @@ void InitDirectory(const char* directory, ArchiveModules& archiveModules)
 
   for(j = 0; j < g_numForbiddenDirs; ++j)
   {
-    if(!string_compare_nocase_upper(directory, g_strForbiddenDirs[j])
-    || (string_length(directory) > string_length(g_strForbiddenDirs[j]) && directory[string_length(directory) - string_length(g_strForbiddenDirs[j]) - 1] == '/' && !string_compare_nocase_upper(directory + string_length(directory) - string_length(g_strForbiddenDirs[j]), g_strForbiddenDirs[j])))
+    char* dbuf = g_strdup(directory);
+    if(*dbuf && dbuf[strlen(dbuf)-1] == '/')
+      dbuf[strlen(dbuf)-1] = 0;
+    const char *p = strrchr(dbuf, '/');
+    p = (p ? (p+1) : dbuf);
+    if(matchpattern(p, g_strForbiddenDirs[j], TRUE))
+    {
+      g_free(dbuf);
       break;
+    }
+    g_free(dbuf);
   }
   if(j < g_numForbiddenDirs)
   {
@@ -380,9 +389,13 @@ void InitDirectory(const char* directory, ArchiveModules& archiveModules)
         if(name == 0)
           break;
 
-       for(j = 0; j < g_numForbiddenDirs; ++j)
-         if(!string_compare_nocase_upper(name, g_strForbiddenDirs[j]))
-           break;
+        for(j = 0; j < g_numForbiddenDirs; ++j)
+        {
+          const char *p = strrchr(name, '/');
+          p = (p ? (p+1) : name);
+          if(matchpattern(p, g_strForbiddenDirs[j], TRUE))
+            break;
+        }
        if(j < g_numForbiddenDirs)
          continue;