Use GetFileAttributes in 'dows
This commit is contained in:
parent
f3f5f346ca
commit
2b821722d2
1 changed files with 4 additions and 2 deletions
|
|
@ -448,9 +448,11 @@ filestatus_t filesearch(char *filename, const char *startpath, UINT64 wantedhash
|
|||
// FIXME: should we also follow symlinks?
|
||||
if ((dent->d_type == DT_DIR && depthleft) || (dent->d_type == DT_LNK && depthleft))
|
||||
#else
|
||||
if (stat(searchpath, &fsstat) < 0) // do we want to follow symlinks? if not: change it to lstat
|
||||
// if we wanna follow symlinks we can check with FILE_ATTRIBUTE_REPARSE_POINT
|
||||
DWORD fileattr = GetFileAttributes(searchpath);
|
||||
if (fileattr == INVALID_FILE_ATTRIBUTES)
|
||||
; // was the file (re)moved? can't stat it
|
||||
else if (S_ISDIR(fsstat.st_mode) && depthleft)
|
||||
else if ((fileattr & FILE_ATTRIBUTE_DIRECTORY) && depthleft)
|
||||
#endif
|
||||
{
|
||||
searchpathindex[--depthleft] = strlen(searchpath) + 1;
|
||||
|
|
|
|||
Loading…
Reference in a new issue