[Implemented] create subdirectories

There is no support to create subdirectories inside DocumentsDirectory, which is quite fast to implement. This limitation doesn’t allow me to use the SDK since i need a very specific directory structure for my app to work. Besides that, having a directory with 1000k+ images isn’t a good idea.
[import]uid: 45445 topic_id: 10356 reply_id: 310356[/import]

you can have different directories outside of you documents directory.

documents directory is for persistent only but you can have them in the resources directory.

and no, there is no way to create directories in corona sdk.

c.

[import]uid: 24 topic_id: 10356 reply_id: 37857[/import]

Having these files on the Resource directory (which is “read-only”) requires them to be in the built file. However I wasn’t able to produce releases bigger than 1GB. Therefore, I need to create a well known directory structure, and download files into these folders using the application. Is there any plans to a mkdir function ? [import]uid: 45445 topic_id: 10356 reply_id: 37891[/import]

Is there still no way to create subdirectories in the Documents directory? [import]uid: 4596 topic_id: 10356 reply_id: 45499[/import]

Is there a reason why SDK doesn’t allow to create subdirectories
under DocumentsDirectory?

I want to store information in subdirectories (as grouping) and delete it sometime later (once a group goes out of scope), it would be much better design then just dumping everything in DocumentsDirectory. [import]uid: 45045 topic_id: 10356 reply_id: 48953[/import]

sandbox.

and is to prevent possible egregious code from being left dangling etc.

c. [import]uid: 24 topic_id: 10356 reply_id: 49017[/import]

I don’t get why I can do it with other tools then, if sandbox is the argument. And dangling files are the responsibility of the programmer, right.

The workaround is to create a sqlite db in your sandbox mimicking a filesystem structure. But, if Ansca wants Corona to be used seriously for UI and file based apps, cd, rmdir and mkdir need to be implemented on Android and iOS alike.

–Maarten [import]uid: 5822 topic_id: 10356 reply_id: 52445[/import]

Yeah, put me down as not buying “sandbox” as an answer. I guess it’s easy just to say “sandbox” when you don’t want to support something.

So I can create any kind of files I want in Documents, as many as I want, databases, whatever, but if I make a subdirectory under Documents then I have somehow left the sandbox? Sorry, but documents in a subdirectory of something in the sandbox are *also* in the sandbox, by definition, at least on every VM or mobile platform I’ve ever worked on. Granted your md code has to prevent smartasses doing path navigation, but that’s not rocket science.

Of course this is a “Give a mouse a cookie” problem. Because if you allow directory creation, then people will probably want to be able to delete them, and enumerate them. Pretty soon you’d have a complete file IO system. Here’s hoping.

[import]uid: 111481 topic_id: 10356 reply_id: 86067[/import]

on Android corona supports creating subdirectories through
the capabilities of the lua language. I suspect it always has.

to do this

  1. ensure the build.settings allows writing to subdirectories. this is important
    or it will *fail*

[lua] androidPermissions =
{
“android.permission.WRITE_EXTERNAL_STORAGE”
}[/lua]

  1. use luas os.execute()
    eg this works for me as I can use TerminalIDE app to verify the directory is created.
    [lua] os.execute("/system/bin/mkdir /sdcard/suniltmp")[/lua]

if you want to save the output of a system command just redirect the output to a file and read it back in using io functions.

I’m sure you could easily use this to deploy and execute shell scripts using corona.
hmmm? [import]uid: 74338 topic_id: 10356 reply_id: 112010[/import]

You don’t need to bother with workarounds anymore.

Lua file system is supported in daily builds and will be in the next public release (which is days away)

http://www.coronalabs.com/blog/2012/05/08/luafilesystem-lfs-tutorial/ [import]uid: 84637 topic_id: 10356 reply_id: 112202[/import]

allready using luafs for on device debug logging -

see http://developer.anscamobile.com/code/android-device-debug-statements

[import]uid: 74338 topic_id: 10356 reply_id: 112409[/import]