From fa69ba942e160a2d4651b9272e144157e44e8598 Mon Sep 17 00:00:00 2001 From: Utkarsh Ayachit Date: Mon, 18 Dec 2006 11:30:09 -0500 Subject: [PATCH] BUG: FileIsDirectory would remove the trailing '/' even when the path is indeed the root i.e. '/'. Hence the test would be incorrect for root directory. Fixed that. --- Source/kwsys/SystemTools.cxx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Source/kwsys/SystemTools.cxx b/Source/kwsys/SystemTools.cxx index 33d3e64c6..61cca36ce 100644 --- a/Source/kwsys/SystemTools.cxx +++ b/Source/kwsys/SystemTools.cxx @@ -2293,7 +2293,8 @@ bool SystemTools::FileIsDirectory(const char* name) // Remove any trailing slash from the name. char buffer[KWSYS_SYSTEMTOOLS_MAXPATH]; int last = static_cast(strlen(name))-1; - if(last >= 0 && (name[last] == '/' || name[last] == '\\')) + if(last > 0 && (name[last] == '/' || name[last] == '\\') + && strcmp(name, "/") !=0) { memcpy(buffer, name, last); buffer[last] = 0;