Dear visitor, welcome to Jabaco - Community.
If this is your first visit here, please read the Help. It explains in detail how this page works.
To use all features of this page, you should consider registering.
Please use the registration form, to register here or read more information about the registration process.
If you are already registered, please login here.
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)?
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:
|
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
In VB it would be "Dim myArray() as Byte" (etc), you can redim later to set bounds, but starts as an empty array--I tried this with Jabaco at one point and it seemed to work...