Posts: 77
Threads: 15
Joined: Mar 2004
I need a way to create folders, save to folders, and open files from folders in a FB program. I'm coding a game creator(side-scroller creator, to be exact), and I plan on having the editor create a folder for each user-created game. Inside the folders, each individual level file would be stored. To do this, I must be able to create and manage folders.
Related question: Once I get around my first problem I'll need a way for the program to get the name for each and every folder in the directory.
Thanks in advance.
nd remember kids, only you can provoke forest fires!
Posts: 3,522
Threads: 189
Joined: Dec 2003
MKDIR
RMDIR
And use relative paths:
gamefolder\folder\level1.level
To get all folders in a dir you have to use some sort of list function, FB has DIR(), but i dont know if you can make it return folders only.
Theres also the SHELL way of doing it..
Posts: 77
Threads: 15
Joined: Mar 2004
Thanks a lot. Do you know of anywhere I can go to research the SHELL way of doing it?
nd remember kids, only you can provoke forest fires!
Posts: 3,522
Threads: 189
Joined: Dec 2003
SHELL "DIR"
Look up the DIR switches, such as: /OGN /-P /B etc..
To get a list of swiches: DIR /?
safest way is to disable any switch you dont use by putting a - infront of it, like: DIR /-P *.*
To dump console info to a file:
SHELL "DIR *.* > mylist.txt"
It will create/overwrite mylist.txt and dump the console info to it.
To append to the end of a file, do: >> instead of >
Posts: 1,407
Threads: 117
Joined: Dec 2002
Perhaps DIR$ should have a new optional parameter, an attribute mask...
Antoni
Posts: 77
Threads: 15
Joined: Mar 2004
I used MKDIR "test" and it created a folder named "test" on my Desktop. :-|
nd remember kids, only you can provoke forest fires!
the exe was on ur desktop, right o.o
Posts: 77
Threads: 15
Joined: Mar 2004
Eh... nevermind, problem solved. When I compiled and ran the program from FBIDE it put the folder on the desktop. When I opened the executable myself it put the folder in the directory of the .exe. So, I got the whole folder business fixed now.
nd remember kids, only you can provoke forest fires!