I have a very simple Lua program. I developed this program on an Apple Mac using Corona. When I ran the program in the Corona simulator, it worked as expected. When I deployed to my iPad Retina, it did not work. I used Xcode on my mac to see the log.
Does anyone know why the program does not work?
project has a directory called sub1, which contains a dir and file.
The program (main.lua):
print (“START”)
local lfs = require(“lfs”)
local cdir = lfs.currentdir()
print (“CDIR:”…cdir)
local sub1 = cdir … “/” … “sub1”
print (“SUB1:” … sub1)
for file in lfs.dir(sub1) do
print (“SUB1FILE:”…file)
end
print (“END”)
os.exit(0)
Output on the simulator is like this;
START
CDIR:/Users/martin/NetBeansProjects/readDirTest
SUB1:/Users/martin/NetBeansProjects/readDirTest/sub1
SUB1FILE:.
SUB1FILE:…
SUB1FILE:sub1.txt
SUB1FILE:sub2
END
0
But when I deployed it on my iPad, the log shows this error;
50.6.10 / 2014.2393
Oct 29 14:41:28 Martins-iPad readDirTest[325] <Warning>: START
Oct 29 14:41:28 Martins-iPad readDirTest[325] <Warning>: CDIR:/
Oct 29 14:41:28 Martins-iPad readDirTest[325] <Warning>: SUB1://sub1
Oct 29 14:41:28 Martins-iPad readDirTest[325] <Warning>: Runtime error
/Users/martin/NetBeansProjects/readDirTest/main.lua:12: cannot open //sub1: No such file or directory
stack traceback:
[C]: in function ‘dir’
/Users/martin/NetBeansProjects/readDirTest/main.lua:12: in main chunk
Oct 29 14:41:28 Martins-iPad locationd[54] <Notice>: Gesture EnabledForTopCLient: 0, EnabledInDaemonSettings: 0
I do not know how to move forward.
Has the sub1 dir not been included with the project?
Is the lfs.currentdir() returning an incorrect path? (it seems to be returning ‘/’)