From 68e876f0064f33352be9c34f9ed55e909e92749b Mon Sep 17 00:00:00 2001 From: Stas Degteff Date: Mon, 30 Nov 2009 18:37:07 +0000 Subject: [PATCH] Optimize is_dir() (use root directory detection in *nix) --- goldlib/gall/gfilutl1.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/goldlib/gall/gfilutl1.cpp b/goldlib/gall/gfilutl1.cpp index 0515d24..0afab13 100644 --- a/goldlib/gall/gfilutl1.cpp +++ b/goldlib/gall/gfilutl1.cpp @@ -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;