How I delete a file?
I saved it with display.save() if that matters… And I want to allow the user to delete it (I am doing a album of sorts in my app). [import]uid: 142895 topic_id: 27700 reply_id: 327700[/import]
How I delete a file?
I saved it with display.save() if that matters… And I want to allow the user to delete it (I am doing a album of sorts in my app). [import]uid: 142895 topic_id: 27700 reply_id: 327700[/import]
You would use os.remove in combination with system.pathForFile
http://docs.coronalabs.com/api/library/os/remove.html
http://docs.coronalabs.com/api/library/system/pathForFile.html
Hope this helps [import]uid: 84637 topic_id: 27700 reply_id: 112341[/import]
Hello!
It ALMOST worked…
I am getting permission denied…
I am deleting a image file, thus I guess I need to ensure it is unloaded first?
I am right now using removeSelf() and then using the pointer to something else, and the delete is triggered by a timer with 500ms.
But this is seemly not sufficient… [import]uid: 142895 topic_id: 27700 reply_id: 112541[/import]
What platform is giving you permission denied? [import]uid: 84637 topic_id: 27700 reply_id: 112558[/import]
Windows.
Android and iOS are targets, but I do not own a Mac or iOS yet, and did not tested yet on Android… [import]uid: 142895 topic_id: 27700 reply_id: 112560[/import]
Just tested on android, it is not deleting there too. [import]uid: 142895 topic_id: 27700 reply_id: 112683[/import]
I was having a similar issue - at least on Win7 & Corona simulator. It appears that there are several apis that do not complete before they return to your code - and I think that image:removeSelf is one. I created a closure that did the os.remove and used timer.performWithDelay to execute the closure after two frames (70ms) to give image:removeSelf time to complete. Worked like a charm (at least one the simulator - have not attempted on devices yet). [import]uid: 117477 topic_id: 27700 reply_id: 115944[/import]