WARNING: Cannot create path...

Hi

I’m using in my game lua files for different levels. The idea is to publish new levels with a new game upgrade. With the script bellow it works just fine on the simulator, I just get this error:

WARNING: Cannot create path for resource file ‘routes/route11.lua’ b/c it does not exist.

But as soon as I put it on a device to test it, the app stops working. The device debugger prints out:

/Corona  ( 4037): > Class.forName: routes.route11.LuaLoader

/Corona  ( 4037): WARNING: Could not load ‘LuaLoader’

/Corona  ( 4037): Runtime error

/Corona  ( 4037): module ‘routes.route11’ not found:resource (routes.route11.lu) does not exist in archive

/Corona  ( 4037):      no field package.preload[‘routes.route11’]

/Corona  ( 4037):      no file ‘(null)/routes.route11.lua’

/Corona  ( 4037):      no file ‘(null)/routes.route11.lua’

/Corona  ( 4037):      no file ‘/data/data/com.oxylus.climber/lib/libroutes.route11.so’

/Corona  ( 4037):      no file ‘./routes.route11.so’

/Corona  ( 4037):      no file ‘(null)/routes.route11.so’

/Corona  ( 4037):      no file ‘/data/data/com.oxylus.climber/lib/libroutes.so’

/Corona  ( 4037):      no file ‘./routes.so’

/Corona  ( 4037):      no file ‘(null)/routes.so’

The code is:

 --CHECK FOR NEW ROUTES local routeId local idx = 0 local topId = 1 --get highest routeId for row in db:nrows("SELECT \* FROM main") do idx = idx + 1 routeId = row.route\_id if ( topId \< routeId ) then topId = routeId end end local fileE = false local newRouteId = topId + 1 --check for new files if jsonCopy.fileExists("routes/route" .. newRouteId .. ".lua") then print("we have new routes") fileE = true end while fileE do local level = require( "routes.route".. newRouteId ) local routeName = level.routeData.route\_name local w = level.routeData.width local h = level.routeData.height local difficulty = level.routeData.difficulty local description = level.routeData.description local q = ("INSERT INTO main (route\_id, route\_name, difficulty, width, height, description) VALUES ('".. newRouteId.."', '" ..routeName .."', '".. difficulty .."', '".. w .."', '" ..h.."', '"..description.."');") db:exec( q ) newRouteId = newRouteId + 1 --check if nnext file exists if jsonCopy.fileNonExists("routes/route" .. newRouteId .. ".lua") then print("no more new routes") fileE = false end end --END CHECKING

And for file checking I use these two scripts:

--CHECK IF FILE DOESN'T EXIST function fileNonExists(fileName, base) assert(fileName, "fileName is missing") local base = base or system.DocumentsDirectory local filePath = system.pathForFile( fileName, base ) local exists = true if (filePath) then -- file may exist. won't know until you open it local fileHandle = io.open( filePath, "r" ) if (fileHandle) then -- nil if no file found exists = false io.close(fileHandle) end end return(exists) end --CHECK IF FILE EXISTS local function fileExists(fileName, base) assert(fileName, "fileName does not exist") local base = base or system.ResourceDirectory local filePath = system.pathForFile( fileName, base ) local exists = false if (filePath) then local fileHandle = io.open( filePath, "r" ) if (fileHandle) then exists = true io.close(fileHandle) end end return(exists) end

Can anyone help please?

Tomaz

I have solved it. I stopped ckecking for new files and just hardcoded the newest file. :slight_smile:

I have solved it. I stopped ckecking for new files and just hardcoded the newest file. :slight_smile:

How do I turn off the compiler warning, WARNING: Cannot create path for resource file…?

I’m doing my own file checking, and the messages are overwhelming in the console. I don’t need them most of the time because I have a fileExists function I use.

How do I turn off the compiler warning, WARNING: Cannot create path for resource file…?

I’m doing my own file checking, and the messages are overwhelming in the console. I don’t need them most of the time because I have a fileExists function I use.