From: Rudolf Polzer Date: Mon, 2 Aug 2010 12:41:22 +0000 (+0200) Subject: fix path trimming involving pk3dirs X-Git-Tag: xonotic-v0.5.0~241 X-Git-Url: http://git.xonotic.org/?a=commitdiff_plain;h=6d93f0d7d9aceab4f7052318ceecaea0e7d8120a;p=xonotic%2Fnetradiant.git fix path trimming involving pk3dirs --- diff --git a/plugins/vfspk3/vfs.cpp b/plugins/vfspk3/vfs.cpp index b73f44e9..e548c6eb 100644 --- a/plugins/vfspk3/vfs.cpp +++ b/plugins/vfspk3/vfs.cpp @@ -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; }