How does AppPath work?
Monkey Forums/Monkey Beginners/How does AppPath work?
| ||
| I am trying to read the directory where the monkey program is run but I am getting a Error : Identifier 'AppPath' not found. I put the brl.databuffer there which is on top of the help file where the apppath command is listed but it does not help.
Import mojo
Import brl.FileSystem
Import brl.databuffer
Class MyGame Extends App
Method OnCreate()
SetUpdateRate(1)
renamedir()
End Method
Method OnUpdate()
End Method
Method OnRender()
Cls 0,0,0
SetColor 255,255,255
'renamedir
End Method
End Class
Function renamedir()
For Local f:=Eachin LoadDir(AppPath())
DebugLog f
Next
End Function
Function Main()
New MyGame()
End function
ps - and how do you rename files? Or do you have to copy and delete files to do that? |
| ||
| Import the os module or brl.process. Edit: The online docs are out of sync with the latest release. and don't use capitols in the imports. |
| ||
| I had tried the os import but it gave an error then. The databuffer import seems to work though. thanks ! |
| ||
| The OS module is strictly for glfw or standard CPP. The brl.process as far as I known should work with the other targets that get regularly updated, but I think HTML is the exception. For renaming you have three approaches: Copy and delete the old Invoke the shells own rename commands. Write native code to interface with the shared libraries that handle the file system. |