Optimize is_dir() (use root directory detection in *nix)

This commit is contained in:
Stas Degteff 2009-11-30 18:37:07 +00:00
parent 1247b0cf02
commit 68e876f006

View File

@ -171,10 +171,13 @@ long fsize(FILE* fp) {
bool is_dir(const TCHAR *path)
{
// Check if it's a root path (X:\)
// Check if it's a root path (X:\ оr /)
#if defined(__HAVE_DRIVES__)
if(g_isalpha(path[0]) and (path[1] == ':') and isslash(path[2]) and (path[3] == NUL))
return true; // The root is a directory
# else
if( isslash(path[0]) and (path[1] == NUL))
return true; // The root is a directory
#endif
Path tmp;