function UILoaderUtilitys.addSearchPathIf(dir, fileUtil)
方法中,如果路径是已经存在的默认路径,在文件读取结束的clearPath中会释放掉,默认路径是丢失,需要加入默认路径判断
function UILoaderUtilitys.addSearchPathIf(dir, fileUtil)
if not fileUtil then
fileUtil = cc.FileUtils:getInstance()
end
-- 判断是不是已经存在的默认路径
local paths = fileUtil:getSearchPaths()
for i=1, #(paths) do
if paths* == dir then
return
end
end
if not UILoaderUtilitys.searchDirs then
UILoaderUtilitys.searchDirs = {}
end
if not UILoaderUtilitys.isSearchExist(dir) then
table.insert(UILoaderUtilitys.searchDirs, dir)
fileUtil:addSearchPath(dir)
end
end
*