summaryrefslogtreecommitdiffstats
path: root/Source/kwsys/SystemTools.cxx
diff options
context:
space:
mode:
authorUtkarsh Ayachit <utkarsh.ayachit@kitware.com>2006-12-18 16:30:09 (GMT)
committerUtkarsh Ayachit <utkarsh.ayachit@kitware.com>2006-12-18 16:30:09 (GMT)
commitfa69ba942e160a2d4651b9272e144157e44e8598 (patch)
tree9229208d4cafbf09d5e014afd835c6b733f0367e /Source/kwsys/SystemTools.cxx
parentb95f198348a7a5d357bfcdb8c37cac95b7d16e8c (diff)
downloadCMake-fa69ba942e160a2d4651b9272e144157e44e8598.zip
CMake-fa69ba942e160a2d4651b9272e144157e44e8598.tar.gz
CMake-fa69ba942e160a2d4651b9272e144157e44e8598.tar.bz2
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.
Diffstat (limited to 'Source/kwsys/SystemTools.cxx')
-rw-r--r--Source/kwsys/SystemTools.cxx3
1 files changed, 2 insertions, 1 deletions
diff --git a/Source/kwsys/SystemTools.cxx b/Source/kwsys/SystemTools.cxx
index 33d3e64..61cca36 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<int>(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;