* mingwex/dirent.c (_tGetFileAttributes): New helper function.
(_topendir): Use it.
This commit is contained in:
parent
5ade5bb0ea
commit
71bbb04de9
|
@ -1,3 +1,8 @@
|
|||
2006-06-18 Danny Smith <dannysmith@users.sourceforge.net>
|
||||
|
||||
* mingwex/dirent.c (_tGetFileAttributes): New helper function.
|
||||
(_topendir): Use it.
|
||||
|
||||
2006-06-18 Danny Smith <dannysmith@users.sourceforge.net>
|
||||
|
||||
* include/sys/time.h: Add header guard. Add extern "C" bracketing
|
||||
|
|
|
@ -28,6 +28,25 @@
|
|||
#define SUFFIX _T("*")
|
||||
#define SLASH _T("\\")
|
||||
|
||||
|
||||
/* Helper for opendir(). */
|
||||
static inline unsigned _tGetFileAttributes (const _TCHAR * tPath)
|
||||
{
|
||||
#ifdef _UNICODE
|
||||
/* GetFileAttributesW does not work on W9x, so convert to ANSI */
|
||||
if (_osver & 0x8000)
|
||||
{
|
||||
char aPath [MAX_PATH];
|
||||
WideCharToMultiByte (CP_ACP, 0, tPath, -1, aPath, MAX_PATH, NULL,
|
||||
NULL);
|
||||
return GetFileAttributesA (aPath);
|
||||
}
|
||||
return GetFileAttributesW (tPath);
|
||||
#else
|
||||
return GetFileAttributesA (tPath);
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
* opendir
|
||||
*
|
||||
|
@ -56,7 +75,7 @@ _topendir (const _TCHAR *szPath)
|
|||
}
|
||||
|
||||
/* Attempt to determine if the given path really is a directory. */
|
||||
rc = GetFileAttributes (szPath);
|
||||
rc = _tGetFileAttributes (szPath);
|
||||
if (rc == (unsigned int)-1)
|
||||
{
|
||||
/* call GetLastError for more error info */
|
||||
|
|
Loading…
Reference in New Issue