BUG 40092
Update
For those who run into this and want to get around it. you can simply do this:
-- As suggested by LERG -- local resourceRoot = system.pathForFile('main.lua', system.ResourceDirectory):sub(1, -9)
Summary
system.pathForFile(), should return the absolute path for a file or folder, but in the latest (and recent) versions of Corona SDK it fails to do so on OS X.
So far, I’ve tested three versions (2015.2570, 2015.2576, and 2015.2605). In each case, I get different results for Windows vs OS X simulators when running this line of code:
What I Did
print( system.pathForFile( '', system.ResourceDirectory ) )
What I Expected
I expected this to print out the folder my app is in (i.e. absolute path of folder containing main.lua).
What I Got
- Windows 7 - Works correctly: ‘x:\work\00_curentprojects\corona\casedetecterror’
-
OS X 10.10.2 - Fails every time. Gives the folder the SDK binary (or something like it) is in instead:
- /Applications/CoronaSDK_2605/Corona Simulator.app/Contents/Resources/CoronaResources.bundle/Contents/Resources/
I’m still doing investigation into this, and will file a bug today, once I’m satisfied I’ve investigated enough.
Request: If you are running an OLD version of Corona on OS X, please try this single line of code. If it prints the right directory, please post here and tell me the version number you are using. This will help me determine when this changed.
Lastly, I’m sure it used to work as I depended upon it for many of my personal and client tools.