Optimize is_dir() (use root directory detection in *nix)
This commit is contained in:
parent
1247b0cf02
commit
68e876f006
@ -171,10 +171,13 @@ long fsize(FILE* fp) {
|
|||||||
|
|
||||||
bool is_dir(const TCHAR *path)
|
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 defined(__HAVE_DRIVES__)
|
||||||
if(g_isalpha(path[0]) and (path[1] == ':') and isslash(path[2]) and (path[3] == NUL))
|
if(g_isalpha(path[0]) and (path[1] == ':') and isslash(path[2]) and (path[3] == NUL))
|
||||||
return true; // The root is a directory
|
return true; // The root is a directory
|
||||||
|
# else
|
||||||
|
if( isslash(path[0]) and (path[1] == NUL))
|
||||||
|
return true; // The root is a directory
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
Path tmp;
|
Path tmp;
|
||||||
|
Reference in New Issue
Block a user