So I have 2 methods of finding out if a file exists. They are both really slow, i’d assume the second method would be faster but is actually even slower. is there some way to just basically see if a file is there without having to load the actual content of the file into memory?
local path = system.pathForFile( filepath, system.DocumentsDirectory )
local myFile = io.open( path, "r" )
io.close(myFile);
local path = system.pathForFile( filepath, system.DocumentsDirectory )
local myFile = io.type(path);
[import]uid: 6317 topic_id: 2324 reply_id: 302324[/import]
i tried using this code block and the downloaded source file to get the directory listing. it works beautifully on simulator, but just halts my app from loading on device. Have oyu tried on actual device with 4.1? [import]uid: 6317 topic_id: 2324 reply_id: 7157[/import]
but I get a message saying that access is denied and suggesting I become a subscriber. I already am a subscriber so I wonder if the URL is perhaps incorrect? [import]uid: 11045 topic_id: 2324 reply_id: 34351[/import]
*If* all you’re dealing with is image files, another imperfect workaround to check for a file’s existence is to check if display.newImage(path) is nil. Would be really nice to have a normal fileExists() function though… [import]uid: 10284 topic_id: 2324 reply_id: 36905[/import]