Been a while since I used Blitz. I'm trying to search through the folder where the program itself is installed for a text file, but readdir needs the target folder to be named. Is there a way to effectively say readdir(the folder the program was loaded from), if I don't know the name of that folder until run-time?
Readdir question
Blitz3D Forums/Blitz3D Beginners Area/Readdir question Readdir CurrentDir()
I've wondered the same thing myself ;)
I've wondered the same thing myself ;)
CurrentDir() is often the same as the programs location, but could be anything.
SystemProperty("appdir") should be the application's directory.
SystemProperty("appdir") should be the application's directory.
managed to do this in VB6 where you podge a button the first time after the application is installed to populate a .ini file (a .txt file) with the path of the executing directory, not sure I managed to get B3D doing it, not to say it can't be done.
This may be more reliable:
Print "Program was run from " + SystemProperty ("appdir")
Esp. in certain cases like running a SCR from within the System folder.
It is even recommended to
changedir SystemProperty ("appdir")
before you try to open a file in your EXEs or SCRs folder.
Print "Program was run from " + SystemProperty ("appdir")
Esp. in certain cases like running a SCR from within the System folder.
It is even recommended to
changedir SystemProperty ("appdir")
before you try to open a file in your EXEs or SCRs folder.