pathForFile on windows/mac

Hello Staff

I though that I found a bug. I using a function to check if a file exists, it works well on windows simulator, but it doesn’t work on mac.

this is the sample code:

function file\_exists(name, path )  
 print("-- test 1");  
 if (path==nil) then  
 path = system.pathForFile( "", system.ResourceDirectory )  
 if (path==nil) then  
 print("FAIL :"..name.." file no exist")  
 return false  
 else  
 local f = io.open(path..name,"r");  
 if (f ~= nil) then   
 io.close( f );  
 --f:close()   
 print("OK :"..path..name.." file exist")  
 return true;   
 else   
 print("FAIL :"..path..name.." file NO exist")  
 return false;   
 end  
 end  
 end  
end  
  
local file = "icon2.png";  
  
if (file\_exists( file )==true) then  
 Image = display.newImage( file);  
end  

off-course, the file “icon2.png” supposed to doesn’t exist. Don’t care about put one.

on windows, the console show me:

-- test 1  
FAIL :D:\sample\icon2.png file NO exist  

on mac, the console show me:

[code]
– test 1
ERROR: The resource file () could not be found at case-sensitive path (/Users/UserName/sample/).
WARNING: Cannot create path for resource file ‘’. File does not exist.

FAIL :icon2.png file no exist
[/code] [import]uid: 29126 topic_id: 10640 reply_id: 310640[/import]