Hi everybody,
I’m almost finishing my app and I’m having some troublesm with iOS/Mac.
While I’m at Windows/Android its runs perfectly, no problem occurs. But when I open the simulator at Mac or Iphone it seems that it can’t read the file or locate it.
Here’s the function that checks if the file exists:
function file\_exists(name) local f=io.open(dataPath..name,"r") if f~=nil then io.close(f) --print("file exists") return true else return false end end
This function always returning false only if I’m at Mac/Iphone.
The dataPath variable it’s defined at this function:
for line in Config:lines() do print(line) print(string.find(line,"false")) if (string.find(line,"false") ~= nil) then print("-false") dataPath = system.pathForFile("",system.TemporaryDirectory) save = false downloadWait("http://alagarta.com/app/info.txt","appinfo.txt","rewrite") --print("temp: ",system.pathForFile("",system.TemporaryDirectory)) else print("-true") dataPath = system.pathForFile("",system.DocumentsDirectory) save = true downloadWait("http://alagarta.com/app/info.txt","appinfo.txt","rewrite") --print("doc:", system.pathForFile("",system.DocumentsDirectory)) end end
The strange thing is: I check manually if the file exists and it’s there. The same function works fine at my android and Windows, so I think it could be something related to dataPath or permission to read files, but I couldn’t find topic about that.
PS: checking the 2nd code (the one where its defined the dataPath), I really don’t think that the problem is with reading files, because it could read the config.txt
Thank You,
Pedro.
