I want to create subdirectories in my documents ("|D|") directory where I want to save/delete some files. I can't figure out which API to call to create a new directory.
@kussakov - I'm not 100% sure, but as no-one else has stepped in, I'll have a go, and bump the question anyway.
I don't think you can. Googling "lua create folder", brings up a number of stackoverflow answers which state this in various ways:
The Lua design philosophy is to be pure ISO C, so as to be portable to anything with a C compiler. There is no directory creation function in the C standard library. This is left up to platform-specific extensions, like mkdir(2) on POSIX systems and CreateDirectory*() on Windows.
So I would guess that creating a folder is dependent upon which operating system you are using.
You can easily do it through plugins. Have you tried plugins yet? Are you working on Android or iOS?
As a thought - if you can't create folders, perhaps you could come up with some naming convention that you can parse and filter like folders,
e.g. If you want a folder called "saves" and inside it you want to create files tempa.dat, tempb.dat etc you'd just call the file saves_tempa.dat and saves_tempb.dat
Just my $0.02
WhiteTree Games - Home, home on the web, where the bits and bytes they do play! #MakeABetterGame! "Never give up, Never NEVER give up!" - Winston Churchill
@ar2rsawseen - I just tried your idea - it return NIL file
@techdojo - Right, I can do something like what you suggest. Basically do my own pseudo directory management and make sure the names are unique. I was just trying to avoid doing that...
Comments
I don't think you can. Googling "lua create folder", brings up a number of stackoverflow answers which state this in various ways: So I would guess that creating a folder is dependent upon which operating system you are using.
You can easily do it through plugins. Have you tried plugins yet? Are you working on Android or iOS?
http://www.giderosmobile.com/forum/discussion/929/file-exists
I also googled a lot before adding the discussion :-)
Bassically we should wait for next releases to create and browse directories.
So what if you tried to open file, which doesn't exist inside folder which doesn't exist?
Something like:
e.g. If you want a folder called "saves" and inside it you want to create files tempa.dat, tempb.dat etc you'd just call the file saves_tempa.dat and saves_tempb.dat
Just my $0.02
#MakeABetterGame! "Never give up, Never NEVER give up!" - Winston Churchill
@techdojo - Right, I can do something like what you suggest. Basically do my own pseudo directory management and make sure the names are unique. I was just trying to avoid doing that...