one question,
can we trust that Temporary and Cache dirs will be purged when needed cross platform?
or is it better to take care of it ourselves?
thx
one question,
can we trust that Temporary and Cache dirs will be purged when needed cross platform?
or is it better to take care of it ourselves?
thx
iOS and Android should purge them. Windows and macOS I’m not sure about. But that said it’s always best to keep a clean house.
Rob
thanks Rob, for your excelent enlight of this matter. it should go strait to documentation.
i will start to use system.ApplicationSupportDirectory to save users data.
The game I’m currently working on, I switched from using a config file to using the new system.getPreference() option to store them in a native way. I have code like:
myData.settings.gamesPlayed = system.getPreference( "app", "gamesPlayed", "number" ) or 0
and
local result = system.setPreferences( "app", myData.settings ) print("result of setting preferences is", result)
It’s perhaps a little more work, but it works for me. The drawback is that you can’t store tables in your settings table… only numbers, strings and booleans. This required me to do some extra work where I wanted to save number number of stars per level.
But yea, I would use system.ApplicationSupportDirectory to save configuration stuff.
just tried to use system.ApplicationSupportDirectory, and it failed on ipad mini 2 with IOS 10.3.2. I’ve the latest version of corona 2017.3108. it crashed my app saying the string was nil trying to copy to that folder.
it worked fine on android 7.1.1 device, windows simulator and mac simulator.
edit: changed the code to use the same old “system.DocumentsDirectory” and it worked fine on all devices.
Can you put together a simple test case that demonstrates this?
Thanks
Rob
sure, it’s really just sending data to that Directory.
Test on device please not in simulator.
Tested right now on another ipad mini 4 still failed.
local origin=system.ResourceDirectory local dest=system.ApplicationSupportDirectory local dbName="saldo.png" local pathSource = system.pathForFile( dbName, origin ) local fileSource = io.open( pathSource, "rb" ) local contentsSource = fileSource:read( "\*a" ) local pathDest = system.pathForFile( dbName, dest ) local fileDest = io.open( pathDest, "wb" ) fileDest:write( contentsSource ) io.close( fileSource ) io.close( fileDest ) local image=display.newImageRect(dbName,dest,200, 90) image:translate(display.contentWidth\*.5,display.contentHeight\*.5)
I ran it on my iPhone 6, running iOS 10.3.2 and it worked as expected.
Rob
like i told you i tested on 2 ipads, mini 2 and 4 both with IOS 10.3.2. failed. i don’t have an iphone to test it.
What OS versions are on those devices?
It failed on my iPad too. Weird. Can you take this project and file a bug report? Use this link to submit the bug report:
https://portal.coronalabs.com/bug-submission
Thanks
Rob
done. if I get a tracking bug number I will post it here.
never got a tracking number, so I guess it failed again posting my bug report…
The last bug report you filed was 24 days ago about display.save.
What URL did you use for the form? Please use this one: https://portal.coronalabs.com/bug-submission.
Thanks
Rob
rob, i did today a bug report. i just pressed the link you sent. uploaded the file, said what was wrong with the code, uploaded. no error was given. just went to the main page.
it’s not the first time this happens, and usually i end up sending bug to the email you send me back.
just resend it again just now. please check if you get it.
sent another one about the bug report it self.
Done.
please try to correct your bug submission webpage.
it’s bad enough to pass half a day trying to find where the bug is, preparing a simple code for you guys, then i need to send it 3 times because your bug report system is not working properly.
bug {10033670}
Hi,
I’m interested in using system.ApplicationSupportDirectory. Any news about crashes on iPad? I can’t test it by myself, because I don’t have an iPad.
i’m still waiting for any feedback from corona…