I am using the code in question 3 here (http://coronalabs.com/blog/2013/02/13/faq-wednesday-sub-folder-and-file-access/) to verify that some files exist before doing some.
My project is set up with all the LUA and font files in the root (Resources) folder. Then I have an Assets folder in that, which has some files and two other folders - Audio and Images.
So I want to check if “Assets/Images/filename.png” exists. According to that blog post above, I should be able to do that since the file is in the Resources folder but in a subfolder.
-- Checking for file in Documents directory local results = doesFileExist( "Images/cat.png", system.DocumentsDirectory ) -- or checking in Resource directory local results = doesFileExist( "Images/cat.png" )
However, when I do a doesFileExist call on “Assets/Images/filename.png”, it always comes back false.
I have the print statements in the doesFileExist enabled so I can see that what paths it is looking for. The first file I am checking for is “Assets/filename.xml” and that it finds fine. It checks and finds it at:
/data/data/[package name]/files/coronaResources/Assets/filename.xml
But when it goes to check for the PNG file, the path it is checking is:
Assets/Images/filename.png
Seeing the note about the Android file restrictions, I added a filename.png.txt file and checked for that, and it does correctly check and find it here:
/data/data/[package name]/files/coronaResources/Assets/Images/filename.png.txt
But according to the example, it should be able to find the PNG file in a subfolder, so why isn’t this working? Is the example wrong? Can you not check for an image file at all that is located in the Resources folder or one of its subfolders?
I am using build 1202 if it matters.