lua -- io.exists

io.exists

测试文件是否存在,如果存在返回 true。

格式:

result = io.exists(路径)
可以使用 CCFileUtils:fullPathForFilename() 函数查找特定文件的完整路径,例如:

local path = CCFileUtils:sharedFileUtils():fullPathForFilename("gamedata.txt")
if io.exists(path) then
    ....
end
原文地址:https://www.cnblogs.com/newlist/p/3649353.html