In kopen4loadfrommod, don't try g_modDir if it's the default "/".

I experienced the following on Windows XP: a few openfrompath() -->
findfrompath() calls were taking enormously long (4.5 secs) to complete, having
been passed a file name like "//bla/qwe.asd".  My guess is that Windows then
tried to interpret these as a network FS path in access(), and the 4.5 secs
represents a timeout value.

git-svn-id: https://svn.eduke32.com/eduke32@2703 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2012-05-28 18:15:22 +00:00
parent 0088ed0591
commit c081f3ab2e

View file

@ -223,11 +223,16 @@ void M32RunScript(const char *s) { UNREFERENCED_PARAMETER(s); }; // needed for
int32_t kopen4loadfrommod(const char *filename, char searchfirst)
{
static char fn[BMAX_PATH];
int32_t r;
int32_t r=-1;
if (g_modDir[0]!='/' || g_modDir[1]!=0)
{
static char fn[BMAX_PATH];
Bsprintf(fn,"%s/%s",g_modDir,filename);
r = kopen4load(fn,searchfirst);
}
Bsprintf(fn,"%s/%s",g_modDir,filename);
r = kopen4load(fn,searchfirst);
if (r < 0)
r = kopen4load(filename,searchfirst);