[INTERPRETER]

* BUG: Fix File.IsHidden() method for paths having "." or ".." element 
  inside.


git-svn-id: svn://localhost/gambas/trunk@7418 867c0c6c-44f3-4631-809d-bfa615b0a4ec
This commit is contained in:
Benoît Minisini 2015-10-17 18:40:29 +00:00
parent 657266cf4b
commit 9e5924c628

View file

@ -678,14 +678,34 @@ BEGIN_METHOD(File_IsHidden, GB_STRING path)
char *path = STRING(path);
int len = LENGTH(path);
int i;
char c;
for (i = 0; i < len; i++)
{
if (path[i] == '.' && (i == 0 || path[i - 1] == '/'))
if (path[i] != '.')
continue;
if (i > 0 && path[i - 1] != '/')
continue;
if (i == (len - 1))
continue;
c = path[i + 1];
if (c == '/')
continue;
if (c == '.')
{
GB_ReturnBoolean(TRUE);
return;
if (i == (len - 2))
continue;
if (path[i + 2] == '/')
continue;
}
GB_ReturnBoolean(TRUE);
return;
}
GB_ReturnBoolean(FALSE);