Hey guys,
I am trying to scan a sub directory for whatever files might be in a certain folder. The example code that is given is fine except that it only shows how to scan the system.DocumentsDirectory (The root), but on IOS I have found that you cannot use “system.pathForFile” to get a path to a directory, it has to be an actual file. Can someone please help me figure out how to get a path to just a folder itself so I can then scan it for files? Here is what I’m attempting…
By the way, I am attempting to look at sub folders that were included in the app package, so its part of “system.ResourcesDirectory”.
--Get the path to the root of the Resources directory local doc\_path = system.pathForFile( "", system.ResourcesDirectory ) --Append onto the path to the folder I am attempting to access doc\_path = doc\_path.."images/"..localProperties.imageDir print(doc\_path) --This now fails when trying to read the path for file in lfs.dir(doc\_path) do if string.find(file, "IMG") then local fileName = string.sub(file, 1, #file - 7) table.insert(slides, "images/"..localProperties.imageDir.."/"..fileName.."IMG.png") table.insert(slideNames, fileName) end end
Any thoughts would be great, been stuck on this for a long while now.