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.
This commit is contained in:
parent
b95f198348
commit
fa69ba942e
@ -2293,7 +2293,8 @@ bool SystemTools::FileIsDirectory(const char* name)
|
|||||||
// Remove any trailing slash from the name.
|
// Remove any trailing slash from the name.
|
||||||
char buffer[KWSYS_SYSTEMTOOLS_MAXPATH];
|
char buffer[KWSYS_SYSTEMTOOLS_MAXPATH];
|
||||||
int last = static_cast<int>(strlen(name))-1;
|
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);
|
memcpy(buffer, name, last);
|
||||||
buffer[last] = 0;
|
buffer[last] = 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user