Cannot Find Files In System.documentsdirectory On Kindle Fire Hd

Hi

I have just about finished my first Corona app and it’s running perfectly on the built in Simulator.  The experience has so far been excellent - However on the Kindle Fire HD it will not read or write files to and from system.DocumentsDirectory.

Further tests seemed to indicate that files could be written and read back from within the application but I cannot for the life of me find them on the device.  I have spent hours and hours (and hours) on this and must surely be missing the obvious ?

Any tips / help / advice / counselling will be much appreciated.

Cheers - Steve

Hi Steve,

When you write to a file on the device via Corona, it is saved in the sandboxed application directory.  This is not a directory you can normally access directly.

Thanks for the reply dchan, I was under the (mistaken?) impression that system.DocumentsDirectory pointed to the /Documents directory on the device, and that that directory was open to all apps and not part of the sandboxed environment. 

If that is not the case must I use a hard coded absolute path to get access to the /Documents directory ?  

All I want to do is drag files onto the Kindle from my computer - use them within my Corona app - and then drag them back onto my computer.  There must be a way to do it - could you let me know how ?

Cheers - Steve

Yes unfortunately your impression was mistaken. 

You can use a hard coded absolute path If you know the structure of the file system on your device. You can use: http://docs.coronalabs.com/api/library/io/index.html to copy the file.  The problem with hard coded absolute paths is that it won’t work across Android devices.  Another way you can do it is to include the file you want to modify in your apk and then email yourself a copy of the modified file.  There are probably other ways to do this but thats all I have off the top of my head.

Thanks, I’m not sure you 100% understand what I’m trying to do, there must surely be a way of accessing (a specific part of) the file system on the device ?

The initial text files will be created on the Kindle or the Computer and saved into the Documents directory.

My Corona app needs to read and write those - just as any other app on the kindle can read and write the Documents directory.

My Corona app doesn’t want to exist in a vacuum, it needs to operate in the eco-system with the other apps - this is possible it has to be ?

Cheers - Steve

Hi Steve,

I don’t think there is a way to do what you want.  Everything Corona does is sandboxed unless you hard code the directory(won’t work across devices).  The reason for this is to maintain cross platform compatibility with ios.  Perhaps in the future we will add something for Android to get out of the sandbox but there is no guarantee if/when that will happen.

Hi dChan

Thanks for your help on this, I’ll have to work something out with email / ftp or similar/

Cheers

Steve

Hi Steve,

When you write to a file on the device via Corona, it is saved in the sandboxed application directory.  This is not a directory you can normally access directly.

Thanks for the reply dchan, I was under the (mistaken?) impression that system.DocumentsDirectory pointed to the /Documents directory on the device, and that that directory was open to all apps and not part of the sandboxed environment. 

If that is not the case must I use a hard coded absolute path to get access to the /Documents directory ?  

All I want to do is drag files onto the Kindle from my computer - use them within my Corona app - and then drag them back onto my computer.  There must be a way to do it - could you let me know how ?

Cheers - Steve

Yes unfortunately your impression was mistaken. 

You can use a hard coded absolute path If you know the structure of the file system on your device. You can use: http://docs.coronalabs.com/api/library/io/index.html to copy the file.  The problem with hard coded absolute paths is that it won’t work across Android devices.  Another way you can do it is to include the file you want to modify in your apk and then email yourself a copy of the modified file.  There are probably other ways to do this but thats all I have off the top of my head.

Thanks, I’m not sure you 100% understand what I’m trying to do, there must surely be a way of accessing (a specific part of) the file system on the device ?

The initial text files will be created on the Kindle or the Computer and saved into the Documents directory.

My Corona app needs to read and write those - just as any other app on the kindle can read and write the Documents directory.

My Corona app doesn’t want to exist in a vacuum, it needs to operate in the eco-system with the other apps - this is possible it has to be ?

Cheers - Steve

Hi Steve,

I don’t think there is a way to do what you want.  Everything Corona does is sandboxed unless you hard code the directory(won’t work across devices).  The reason for this is to maintain cross platform compatibility with ios.  Perhaps in the future we will add something for Android to get out of the sandbox but there is no guarantee if/when that will happen.

Hi dChan

Thanks for your help on this, I’ll have to work something out with email / ftp or similar/

Cheers

Steve