]> git.xonotic.org Git - xonotic/netradiant.git/commitdiff
fix path trimming involving pk3dirs
authorRudolf Polzer <divverent@alientrap.org>
Mon, 2 Aug 2010 12:41:22 +0000 (14:41 +0200)
committerRudolf Polzer <divverent@alientrap.org>
Mon, 2 Aug 2010 12:41:22 +0000 (14:41 +0200)
plugins/vfspk3/vfs.cpp

index b73f44e986245e2b36b177f9074142855943c617..e548c6eba5e50055b9fe41e97ec942fb9abfbcc4 100644 (file)
@@ -552,15 +552,15 @@ const char* FindFile(const char* relative)
 
 const char* FindPath(const char* absolute)
 {
+  const char *best = "";
   for(archives_t::iterator i = g_archives.begin(); i != g_archives.end(); ++i)
   {
-    if(path_equal_n(absolute, (*i).name.c_str(), string_length((*i).name.c_str())))
-    {
-      return (*i).name.c_str();
-    }
+       if(string_length((*i).name.c_str()) > string_length(best))
+      if(path_equal_n(absolute, (*i).name.c_str(), string_length((*i).name.c_str())))
+        best = (*i).name.c_str();
   }
 
-  return "";
+  return best;
 }