You are not logged in.

axtens

Trainee

  • "axtens" is male
  • "axtens" started this thread

Posts: 37

Date of registration: Mar 16th 2009

Location: Perth, WA, Australia

Occupation: Software/Test Engineer

Hobbies: be a husband and a dad, play ukulele, sing

  • Send private message

1

Sunday, October 4th 2009, 4:40pm

What the Jabaco equiv for Dir$() and GetAttr()?

Is there a place in the Community somewhere where there's a table of VB6 keyword to Jabaco replacement? For instance, I'd like to convert the code below to Jabaco, but having no background whatsoever in Java makes it pretty hard.

Jabaco Source

1
2
3
4
5
6
Dim A As String
  A = Dir$("C:\*.*", vbDirectory)
  Do While A <> ""
 	   Debug.Print A, GetAttr("C:" & A)
 	   A = Dir$
  Loop


Regards,
Bruce.

OlimilO

Intermediate

  • "OlimilO" is male

Posts: 277

Date of registration: Jan 18th 2009

Location: Germany

Occupation: software engineer

  • Send private message

2

Monday, October 5th 2009, 1:48am

Hi Bruce,

I've "tried" to implement Dir and GetAttr you can find it in the module FileSystem the same as in VB.

for updating your Framework: in Jabaco click the menu item "?"->"Get the latest snapshot".



But ... you can not use it like you did it here, however thanks to your hint, until now.
Do you want to implement it? it's possible ...

in Java you simply need java#io#File.listFiles() which delivers an array of files



Are you already a Jabaco-Framework developer? :)

have you seen the tutorial: Develop the Jabaco Framework



a thought where you could start from (untested)

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
Dim myDir As java#io#File
Dim myDirIndex As Integer
Dim myDirFiles() As java#io#File
Public Sub Command1_Click()
  Dim A As String
  A = Dir("C:", vbDirectory)
  Do While A <> ""
     Debug.Print A '& "  " & GetAttr("C:" & A)
     A = Dir
  Loop
End Sub
Private Function Dir() As String
   If myDirIndex <= UBound(myDirFiles) Then
      Dir = myDirFiles(myDirIndex).getName
      myDirIndex = myDirIndex + 1
   Else
      myDirIndex = 0
      Dir = ""
   End If
End Function
Private Function Dir(PathName As String, attr As VbFileAttribute) As String
   myDir = New java#io#File(PathName)
   Dir = myDir.getPath
   myDirFiles = myDir.listFiles
End Function



OlimilO

Rate this thread
WoltLab Burning Board