diff --git a/src/d_main.c b/src/d_main.c index 1b4baa87e..b9c0b5403 100644 --- a/src/d_main.c +++ b/src/d_main.c @@ -1272,21 +1272,27 @@ static void IdentifyVersion(void) srb2waddir = I_LocateWad(); #endif + char tempsrb2path[256] = "."; + getcwd(tempsrb2path, 256); + // get the current directory (possible problem on NT with "." as current dir) - if (srb2waddir) + if (!srb2waddir) { - strlcpy(srb2path, srb2waddir, sizeof(srb2path)); - } - else - { - if (getcwd(srb2path, sizeof(srb2path))) - srb2waddir = srb2path; + if (tempsrb2path[0]) + srb2waddir = tempsrb2path; else { srb2waddir = srb2path; } } +#if (1) // reduce the amount of findfile by only using full cwd in this func + if (strcmp(tempsrb2path, srb2waddir)) +#endif + { + strlcpy(srb2path, srb2waddir, sizeof (srb2path)); + } + // Load the IWAD if (!AddIWAD()) { diff --git a/src/d_netfil.c b/src/d_netfil.c index df373c85d..cf3cccaca 100644 --- a/src/d_netfil.c +++ b/src/d_netfil.c @@ -1208,23 +1208,29 @@ filestatus_t findfile(char *filename, const UINT8 *wantedmd5sum, boolean complet // if not found at all, just move on without doing anything } - // next, check SRB2's "home" directory - homecheck = filesearch(filename, srb2home, wantedmd5sum, completepath, 10); + // next, check SRB2's "home" directory (if non-'.') + if (strcmp(srb2home, ".")) + { + homecheck = filesearch(filename, srb2home, wantedmd5sum, completepath, 10); - if (homecheck == FS_FOUND) // we found the file, so return that we have :) - return FS_FOUND; - else if (homecheck == FS_MD5SUMBAD) // file has a bad md5; move on and look for a file with the right md5 - badmd5 = true; - // if not found at all, just move on without doing anything + if (homecheck == FS_FOUND) // we found the file, so return that we have :) + return FS_FOUND; + else if (homecheck == FS_MD5SUMBAD) // file has a bad md5; move on and look for a file with the right md5 + badmd5 = true; + // if not found at all, just move on without doing anything + } - // next, check SRB2's "path" directory - homecheck = filesearch(filename, srb2path, wantedmd5sum, completepath, 10); + // next, check SRB2's "path" directory (also if non-'.') + if (strcmp(srb2path, ".")) + { + homecheck = filesearch(filename, srb2path, wantedmd5sum, completepath, 10); - if (homecheck == FS_FOUND) // we found the file, so return that we have :) - return FS_FOUND; - else if (homecheck == FS_MD5SUMBAD) // file has a bad md5; move on and look for a file with the right md5 - badmd5 = true; - // if not found at all, just move on without doing anything + if (homecheck == FS_FOUND) // we found the file, so return that we have :) + return FS_FOUND; + else if (homecheck == FS_MD5SUMBAD) // file has a bad md5; move on and look for a file with the right md5 + badmd5 = true; + // if not found at all, just move on without doing anything + } // finally check "." directory homecheck = filesearch(filename, ".", wantedmd5sum, completepath, 10);