Hi, I finally got to work with the new LFS API, but unfortunately hit the bump I can’t solve within 5 minutes.
My question is not directly related to LFS, but to old system.pathForFile() function.
So let’s say I want to list files in a folder, there is a great Jon’s tutorial that is a simple as:
local lfs = require "lfs"
local doc\_path = system.pathForFile( "", system.DocumentsDirectory )
for file in lfs.dir(doc\_path) do
-- file is the current file or directory name
print( "Found file: " .. file )
end
HOWEVER, this doesn’t work for system.ResourceDirectory, because system.pathForFile will always return nil if ResourceDirectory is provided as an argument.
I spent an hour searching forums and documentation on how to get an absolute path to system.ResourceFolder, but still can’t seem to find a solution.
Alternatively, how could I get path to a folder within a resource directory ?
System.pathForFile only returns path if a FILE is found, but if I have for example a folder called “projects” in my ResourceDirectory,
this will return nil:
-- this returns nil
local pathToProjectsFolder = system.pathForFile( "projects", system.ResourceDirectory )
Thanks for any solution, this would be a really critical information for my work on the current (big-scale) business application.
[import]uid: 80100 topic_id: 26619 reply_id: 326619[/import]
[import]uid: 80100 topic_id: 26619 reply_id: 107886[/import]