Dear Cerberus X User!
As we prepare to transition the forum ownership from Mike to Phil (TripleHead GmbH), we need your explicit consent to transfer your user data in accordance with our amended Terms and Rules in order to be compliant with data protection laws.
Please read the new Terms and Rules below, check the box to agree, and click "Accept" to continue enjoying your Cerberus X Forum experience. The deadline for consent is April 5, 2024.
Do not accept the amended Terms and Rules if you do not wish your personal data to be transferred to the future forum owner!
Accepting ensures:
- Continued access to your account with a short break for the actual transfer.
- Retention of your data under the same terms.
Without consent:
- You don't have further access to your forum user account.
- Your account and personal data will be deleted after April 5, 2024.
- Public posts remain, but usernames indicating real identity will be anonymized. If you disagree with a fictitious name you have the option to contact us so we can find a name that is acceptable to you.
We hope to keep you in our community and see you on the forum soon!
All the best
Your Cerberus X Team
Function RenewList()
Print "Enter Renew List: " + Gui.FileOperations.File_CurrentPath
Local FileList:String[] = LoadDir(Gui.FileOperations.File_CurrentPath)
For Local temp:String = Eachin FileList
Print temp
next
Use brl.process, it has a CurrentDir function. Don't ask me why it is in that module. I simply don't know.I did see at the top of the os module the word deprecating and to use brl.filesystem and brl.filepath instead however neither has a CurrentDir function used in gbFileOperations.
Import brl.filesystem
Import brl.filepath
Import brl.process
Import mojo
Function Main:Int()
New MyGame()
Return 0
End function
Class MyGame Extends App
Field curDir:= CurrentDir()
Method OnCreate()
End Method
Method OnUpdate()
Local dirList:String[] = LoadDir(curDir)
For Local item:=Eachin dirList
If FileType(item) = FILETYPE_DIR
Print(item + " <Dir>")
Else
Print(item)
End If
Next
'now try changing directory up
If KeyHit(KEY_UP)
Local L:String[] = curDir.Split("/")
If L.Length < 2 Then Return 0
Local NewPath:String
For Local i = 0 To L.Length - 2
If NewPath = "" Then
NewPath = L[i]
Else
NewPath = NewPath + "/" + L[i]
End If
Next
curDir = NewPath
Print curDir
End if
End Method
End Class
Yes, it is called basically at the set framerate. See mojo.app.SetUpdateRate to see its effects. Default is set to 60 frames per second.It’s because the siting is in OnUpdate and gets called every frame
Import brl.filesystem
Import brl.filepath
Import brl.process
Import mojo
Function Main:Int()
New MyGame()
Return 0
End function
Class MyGame Extends App
Field curDir:= CurrentDir()
Field dirList:String[]
Field dirChanged:Bool
Method OnCreate()
RenewList()
dirChanged=False
End Method
Method OnUpdate()
If dirChanged
RenewList()
dirChanged = False
End If
'now try changing directory up
If KeyHit(KEY_UP)
Local L:String[] = curDir.Split("/")
If L.Length < 2 Then Return 0
Local NewPath:String
For Local i = 0 To L.Length - 2
If NewPath = "" Then
NewPath = L[i]
Else
NewPath = NewPath + "/" + L[i]
End If
Next
curDir = NewPath
dirChanged = True
Print curDir
End if
End Method
Method RenewList()
dirList = LoadDir(curDir)
For Local item:=Eachin dirList
If FileType(item) = FILETYPE_DIR
Print(item + " <Dir>")
Else
Print(item)
End If
Next
End Method
End Class
Function LoadDir:String[]( path:String,recursive:Bool=False,hidden:Bool=False )
Local dirs:=New StringDeque
Local files:=New StringStack
If Not path.EndsWith( "/" ) path+="/"
#If HOST<>"winnt"
If Not ( path.StartsWith( "/" ) Or path.StartsWith( "." )) Then path="/"+path
#End
dirs.PushLast ""
While Not dirs.IsEmpty()
Local dir:String=dirs.PopFirst()
For Local f:String=Eachin _LoadDir( path+dir )
If Not hidden And f.StartsWith(".") Continue
Local p:=dir+f
files.Push p
If recursive And FileType( path+p )=FILETYPE_DIR dirs.PushLast p+"/"
Next
Wend
Return files.ToArray()
End
Import brl.filesystem
Import brl.filepath
Import brl.process
Import mojo
Function Main:Int()
New MyGame()
Return 0
End function
Class MyGame Extends App
Field curDir:= CurrentDir()
Field dirList:String[]
Field dirChanged:Bool
Method OnCreate()
RenewList()
dirChanged=False
End Method
Method OnUpdate()
If dirChanged
RenewList()
dirChanged = False
End If
'now try changing directory up
If KeyHit(KEY_UP)
Local L:String[] = curDir.Split("/")
If L.Length < 2 Then Return 0
Local NewPath:String
For Local i = 0 To L.Length - 2
If NewPath = "" Then
NewPath = L[i]
Else
NewPath = NewPath + "/" + L[i]
End If
Next
curDir = NewPath
dirChanged = True
Print curDir
End if
End Method
Method RenewList()
dirList = LoadDir(curDir)
For Local item:=Eachin dirList
Print (FileType(item)) 'added this**********
If FileType(item) = FILETYPE_DIR
Print(item + " <Dir>")
Else
Print(item)
End If
Next
End Method
End Class