In game code, calling
ls() only returns names of cart files.
To make it possible to write local game launchers and other mini-splores, it would be nice to have a way to get directories too (some of us are hoarders and have to organize carts).
ls() -- same as now ls(0x2) -- get directories only ls(0x3) -- (maybe) get other kinds of files -- (for art tools and such, to build dialogs instead of -i / stdin / drag n drop) -- or ls() -- unchanged lsdir() -- new -- will also need `cd(path)` to go there and list carts, or `ls(path)`
Thanks for considering this!
If we're gonna talk about
DIR(), @merwok, may I suggest it RETURN back into Pico-8, that it can be used inside code.
Current Pico-8 it does nothing now, and I've been on this site long enough to know that previous versions of Pico-8, it USED to work inside code. For some reason it was disabled.
As for your suggestions, I agree with you. It would be nice to navigate existing carts in this manner.
You can also type
dir * to view all files in a directory regardless of extension. Not great, but better than listing only directories and a handful of extensions.
Oh for goodness sakes ... I seem to remember, something about this @b0b89. Right outta my mind.
It probably comes from thinking of QBasic. It never had that. It had
files and files by itself would list everything in the directory.
Some QBasic games that didn't really wanna go the distance for showing a clean directory, would just do
files "*.gam" and stuff like that.
Let me try what you have here ...
Oh my gosh there it is. Huh ... So, yeah, we can make a file base program then ...
In fact the help file doesn't even list it. Searched for
ls( by itself and nothing came up.
And it =IS=
dir works in immediate mode, but does nothing in code.
dir is more familiar to me, from DOS.
ls I knew was from UNIX so I just avoided it.
So many factors here that would never let me see that
ls() is not a verb in code but a noun. It does no action by itself, but it =DOES= contain data.
Thanks for showing me this, @b0b89. Without that - I never would've solved this - especially since I can't even find it in the HELP file.
Committing this to memory and my notes ...
You’re right, it’s not in the manual, but in the changelog!
Trouble in paradise. You cannot use any arguments with
ls() So you cannot, for instance, use
ls("..") or what have you.
cd for change directory does not work at all. So ... to the best of my knowledge it's not possible to make an effective filer program in Pico-8 where you can change directories, see all extensions, and examine files.
[Please log in to post a comment]