remove skipexclude variable

with the folderchange check this becomes erronous
This commit is contained in:
Alug committed 2025-08-26 12:04:00 +02:00
1 parent 620315be5b
commit f2f2b40120
6 files changed
+14 -16

No files matched your search

+6 -6
View File
@@ -1179,7 +1179,7 @@ filestatus_t findfile(char *filename, const UINT8 *wantedmd5sum, boolean complet
if (cv_addons_option.value == 3 && *cv_addons_folder.string != '\0')
{
// first, check any custom directory if specified
homecheck = filesearch(filename, cv_addons_folder.string, wantedmd5sum, completepath, 10, false);
homecheck = filesearch(filename, cv_addons_folder.string, wantedmd5sum, completepath, 10);
if (homecheck == FS_FOUND) // we found the file, so return that we have :)
return FS_FOUND;
@@ -1189,7 +1189,7 @@ filestatus_t findfile(char *filename, const UINT8 *wantedmd5sum, boolean complet
}
// next, check "DOWNLOAD" directory
homecheck = filesearch(filename, "DOWNLOAD", wantedmd5sum, completepath, 10, false);
homecheck = filesearch(filename, "DOWNLOAD", wantedmd5sum, completepath, 10);
if (homecheck == FS_FOUND) // we found the file, so return that we have :)
return FS_FOUND;
@@ -1198,7 +1198,7 @@ filestatus_t findfile(char *filename, const UINT8 *wantedmd5sum, boolean complet
// if not found at all, just move on without doing anything
// next, check "addons" directory
homecheck = filesearch(filename, "addons", wantedmd5sum, completepath, 10, false);
homecheck = filesearch(filename, "addons", wantedmd5sum, completepath, 10);
if (homecheck == FS_FOUND) // we found the file, so return that we have :)
return FS_FOUND;
@@ -1208,7 +1208,7 @@ filestatus_t findfile(char *filename, const UINT8 *wantedmd5sum, boolean complet
}
// next, check SRB2's "home" directory
homecheck = filesearch(filename, srb2home, wantedmd5sum, completepath, 10, true);
homecheck = filesearch(filename, srb2home, wantedmd5sum, completepath, 10);
if (homecheck == FS_FOUND) // we found the file, so return that we have :)
return FS_FOUND;
@@ -1217,7 +1217,7 @@ 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 "path" directory
homecheck = filesearch(filename, srb2path, wantedmd5sum, completepath, 10, true);
homecheck = filesearch(filename, srb2path, wantedmd5sum, completepath, 10);
if (homecheck == FS_FOUND) // we found the file, so return that we have :)
return FS_FOUND;
@@ -1226,7 +1226,7 @@ filestatus_t findfile(char *filename, const UINT8 *wantedmd5sum, boolean complet
// if not found at all, just move on without doing anything
// finally check "." directory
homecheck = filesearch(filename, ".", wantedmd5sum, completepath, 10, true);
homecheck = filesearch(filename, ".", wantedmd5sum, completepath, 10);
if (homecheck != FS_NOTFOUND) // if not found this time, fall back on the below return statement
return homecheck; // otherwise return the result we got
+2 -2
View File
@@ -1862,7 +1862,7 @@ static const char *searchWad(const char *searchDir)
filestatus_t fstemp;
strcpy(tempsw, WADKEYWORD1);
fstemp = filesearch(tempsw, searchDir, NULL, true, 20, true);
fstemp = filesearch(tempsw, searchDir, NULL, true, 20);
if (fstemp == FS_FOUND)
{
pathonly(tempsw);
@@ -1870,7 +1870,7 @@ static const char *searchWad(const char *searchDir)
}
strcpy(tempsw, WADKEYWORD2);
fstemp = filesearch(tempsw, searchDir, NULL, true, 20, true);
fstemp = filesearch(tempsw, searchDir, NULL, true, 20);
if (fstemp == FS_FOUND)
{
pathonly(tempsw);
+3 -4
View File
@@ -391,7 +391,7 @@ static const char *exclude_paths[] = {
};
#endif
filestatus_t filesearch(char *filename, const char *startpath, const UINT8 *wantedmd5sum, boolean completepath, int maxsearchdepth, boolean skipexclude)
filestatus_t filesearch(char *filename, const char *startpath, const UINT8 *wantedmd5sum, boolean completepath, int maxsearchdepth)
{
filestatus_t retval = FS_NOTFOUND;
DIR **dirhandle;
@@ -404,7 +404,7 @@ filestatus_t filesearch(char *filename, const char *startpath, const UINT8 *want
int depthleft = maxsearchdepth;
char searchpath[1024];
size_t *searchpathindex;
boolean folderchanged = true;
boolean folderchanged = true; // tells us if we changed folders during traversal
dirhandle = (DIR**)malloc(maxsearchdepth * sizeof(DIR*));
searchpathindex = (size_t *)malloc(maxsearchdepth * sizeof(size_t));
@@ -453,7 +453,7 @@ filestatus_t filesearch(char *filename, const char *startpath, const UINT8 *want
}
// skip some folders that wont have addons in them
if (skipexclude && folderchanged)
if (folderchanged)
{
boolean skipfolder = false;
@@ -500,7 +500,6 @@ filestatus_t filesearch(char *filename, const char *startpath, const UINT8 *want
}
// Linux and FreeBSD has a special field for file type on dirent, so use that to speed up lookups.
// FIXME: should we also follow symlinks?
if ((dent->d_type == DT_DIR && depthleft) || (dent->d_type == DT_LNK && depthleft))
#elif defined (_WIN32)
// if we wanna follow symlinks we can check with FILE_ATTRIBUTE_REPARSE_POINT
+1 -2
View File
@@ -24,14 +24,13 @@ extern consvar_t cv_addons_option, cv_addons_folder, cv_addons_md5, cv_addons_sh
\param wantedmd5sum want to check with MD5
\param completepath want to return the complete path of the file?
\param maxsearchdepth the max depth to search for the file
\param skipexclude when true this skips certain named folders
\return filestatus_t
*/
filestatus_t filesearch(char *filename, const char *startpath, const UINT8 *wantedmd5sum, boolean completepath, int maxsearchdepth, boolean skipexclude);
filestatus_t filesearch(char *filename, const char *startpath, const UINT8 *wantedmd5sum, boolean completepath, int maxsearchdepth);
#define menudepth 20
+1 -1
View File
@@ -2467,7 +2467,7 @@ static const char *searchWad(const char *searchDir)
filestatus_t fstemp;
strcpy(tempsw, WADKEYWORD1);
fstemp = filesearch(tempsw, searchDir, NULL, true, 20, true);
fstemp = filesearch(tempsw, searchDir, NULL, true, 20);
if (fstemp == FS_FOUND)
{
pathonly(tempsw);
+1 -1
View File
@@ -58,7 +58,7 @@ static char *searchFont(const char *fontsearchDir)
filestatus_t fstemp;
strcpy(tempsw, FONTFILE);
fstemp = filesearch(tempsw, fontsearchDir, NULL, true, 20, true);
fstemp = filesearch(tempsw, fontsearchDir, NULL, true, 20);
if (fstemp == FS_FOUND)
{
return tempsw;