!S_ISDIR( stat_info.st_mode ) )
#elif defined(WIN32)
+ int i_ret;
+
# ifdef UNICODE
- wchar_t pwsz_path[MAX_PATH];
- mbstowcs( pwsz_path, p_access->psz_path, MAX_PATH );
- pwsz_path[MAX_PATH-1] = 0;
- if( !(GetFileAttributes( pwsz_path ) & FILE_ATTRIBUTE_DIRECTORY) )
+ wchar_t psz_path[MAX_PATH];
+ mbstowcs( psz_path, p_access->psz_path, MAX_PATH );
+ psz_path[MAX_PATH-1] = 0;
# else
- if( !(GetFileAttributes( p_access->psz_path ) & FILE_ATTRIBUTE_DIRECTORY) )
+ char *psz_path = p_access->psz_path;
# endif
+ i_ret = GetFileAttributes( psz_path );
+ if( i_ret == -1 || !(i_ret & FILE_ATTRIBUTE_DIRECTORY) )
+
#else
if( strcmp( p_access->psz_access, "dir") &&
strcmp( p_access->psz_access, "directory") )
char psz_path[MAX_PATH + 256];
WIN32_FIND_DATA finddata;
HANDLE handle;
- unsigned int rc;
+ int rc;
#else
int i_dirlen;
DIR * dir;
MultiByteToWideChar( CP_ACP, 0, psz_dir, -1, psz_wdir, MAX_PATH );
rc = GetFileAttributes( psz_wdir );
- if( !(rc & FILE_ATTRIBUTE_DIRECTORY) ) return; /* Not a directory */
+ if( rc<0 || !(rc&FILE_ATTRIBUTE_DIRECTORY) ) return; /* Not a directory */
/* Parse all files in the directory */
swprintf( psz_wpath, L"%ls\\*", psz_wdir );
#else
rc = GetFileAttributes( psz_dir );
- if( !(rc & FILE_ATTRIBUTE_DIRECTORY) ) return; /* Not a directory */
+ if( rc<0 || !(rc&FILE_ATTRIBUTE_DIRECTORY) ) return; /* Not a directory */
#endif
/* Parse all files in the directory */