Dir() and wildcards
Experimenting with Dir(). If a file "c:\test.txt" exists, Dir() seems to only partly work:
sFile=dir("c:\test.txt") returns "test.txt" meaning the file's existance was found.
sFile=dir("c:\*.txt") returns blank, when VB would have returned "test.txt" (applying the wildcard.)
Is it possible Jabaco uses a different wildcard character than "*" (asterisk)?
sFile=dir("c:\test.txt") returns "test.txt" meaning the file's existance was found.
sFile=dir("c:\*.txt") returns blank, when VB would have returned "test.txt" (applying the wildcard.)
Is it possible Jabaco uses a different wildcard character than "*" (asterisk)?
Currently wildcards are not supported. Dir() is currently only a raw implementation. Have a look at its code:
http://code.google.com/p/jabacoframework…System.jsrc#321
But if you download the svn, there is an example program included, where you can browse throw the directorys.
Here a part of it a little bit changed for you. Possible it helps ypu:
http://code.google.com/p/jabacoframework…System.jsrc#321
But if you download the svn, there is an example program included, where you can browse throw the directorys.
Here a part of it a little bit changed for you. Possible it helps ypu:
|
|
Jabaco Source |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
Public Sub Command1_Click() Dim myDirectory As String Dim myHidden As Boolean myDirectory = "C:\" myHidden = True Dim MsgString As String = "" Dim tmpString As String Dim myFile As New java#io#File(myDirectory) Dim myList = myFile.listFiles Dim myItem As String For i = 0 To Ubound(myList) myItem = myList(i).getName() If (myList(i).isFile()=True) Then IF (NOT (myHidden=False AND myList(i).isHidden()=True)) Then tmpString = myList(i).getName() MsgString = MsgString + tmpString + Chr$(13) + Chr$(10) End If End If Next MsgBox MsgString End Sub |
This sample raises the question of how to define a genuine Java array in Jabaco code.
"Dim myList" does not specify a variable type. The return value to myFile.listFiles, however, is an array of File.
Is there any proper way in Jabaco to define array variables like "myList" with an explicit variable type?
Out of a similar reason I have not managed to call a Java function out of Jabaco which requires an array of char parameter.
Any ideas?
Greetings!
A1880
"Dim myList" does not specify a variable type. The return value to myFile.listFiles, however, is an array of File.
Is there any proper way in Jabaco to define array variables like "myList" with an explicit variable type?
Out of a similar reason I have not managed to call a Java function out of Jabaco which requires an array of char parameter.
Any ideas?
Greetings!
A1880
