system.pathForFile with directories???

I have continuing problems using system.pathForFile with directories.
The following code returns nil for q even though the directory “mydir” exists.
This seems to be incorrect behavior. Please help!

local target = "mydir"  
local targetBaseDir = system.ResourceDirectory  
  
local q = system.pathForFile(target, targetBaseDir)  
local qq = system.pathForFile(nil, targetBaseDir)  
  
print (q)  
print (qq)  

[import]uid: 37366 topic_id: 32065 reply_id: 332065[/import]

I don’t think you can “look up” a directory using this API, only an explicit file. Is the directory (in this case “mydir”) a constant directory that you created for your app, or are you trying to detect if some directory (name varies) exists? If so, you should look into the LFS (Lua File System) which lets you peek around and manipulate files/folders more directly.

Does this help at all?

Brent [import]uid: 9747 topic_id: 32065 reply_id: 127787[/import]

You should be able to: An example in the FAQ says you can (http://www.coronalabs.com/blog/2012/05/16/faq-wednesday-5/ )

I’ve used it extensively, often to read folders, but I can’t figure out the non-intuitive things it doesn’t do. Perhaps it doesn’t do this in the system directory? I’m not sure, but it’s driving me nuts. [import]uid: 37366 topic_id: 32065 reply_id: 127843[/import]

I don’t think you can “look up” a directory using this API, only an explicit file. Is the directory (in this case “mydir”) a constant directory that you created for your app, or are you trying to detect if some directory (name varies) exists? If so, you should look into the LFS (Lua File System) which lets you peek around and manipulate files/folders more directly.

Does this help at all?

Brent [import]uid: 9747 topic_id: 32065 reply_id: 127787[/import]

You should be able to: An example in the FAQ says you can (http://www.coronalabs.com/blog/2012/05/16/faq-wednesday-5/ )

I’ve used it extensively, often to read folders, but I can’t figure out the non-intuitive things it doesn’t do. Perhaps it doesn’t do this in the system directory? I’m not sure, but it’s driving me nuts. [import]uid: 37366 topic_id: 32065 reply_id: 127843[/import]