[INTERPRETER]
* NEW: File.IsHidden() is a new static method that returns if a path is hidden, i.e. if its filename or one of its directory components starts with a dot. [GB.FORM] * NEW: Setting an hidden path to a DirChooser or FileChooser automatically toggles the ShowHidden property if needed. git-svn-id: svn://localhost/gambas/trunk@7414 867c0c6c-44f3-4631-809d-bfa615b0a4ec
This commit is contained in:
parent
0edfabd984
commit
bc6493120e
@ -425,6 +425,9 @@ Public Sub SetPath(sPath As String)
|
||||
Dim sMsg As String
|
||||
|
||||
If Not IsDir(File.Dir(sPath)) Then sMsg = ("Directory not found.")
|
||||
|
||||
If File.IsHidden(sPath) Then SetShowHidden(True)
|
||||
|
||||
SetDir(File.Dir(sPath))
|
||||
|
||||
If Not GetMulti() Then
|
||||
|
@ -673,6 +673,25 @@ BEGIN_METHOD(File_IsRelative, GB_STRING path)
|
||||
|
||||
END_METHOD
|
||||
|
||||
BEGIN_METHOD(File_IsHidden, GB_STRING path)
|
||||
|
||||
char *path = STRING(path);
|
||||
int len = LENGTH(path);
|
||||
int i;
|
||||
|
||||
for (i = 0; i < len; i++)
|
||||
{
|
||||
if (path[i] == '.' && (i == 0 || path[i - 1] == '/'))
|
||||
{
|
||||
GB_ReturnBoolean(TRUE);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
GB_ReturnBoolean(FALSE);
|
||||
|
||||
END_METHOD
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
BEGIN_PROPERTY(Stream_Handle)
|
||||
@ -910,6 +929,7 @@ GB_DESC NATIVE_File[] =
|
||||
GB_STATIC_METHOD("SetBaseName", "s", File_SetBaseName, "(Path)s(NewBaseName)s"),
|
||||
|
||||
GB_STATIC_METHOD("IsRelative", "b", File_IsRelative, "(Path)s"),
|
||||
GB_STATIC_METHOD("IsHidden", "b", File_IsHidden, "(Path)s"),
|
||||
|
||||
GB_STATIC_METHOD("Load", "s", File_Load, "(FileName)s"),
|
||||
GB_STATIC_METHOD("Save", NULL, File_Save, "(FileName)s(Data)s"),
|
||||
|
Loading…
x
Reference in New Issue
Block a user