How to turn off warnings for missing Images?

Hey guys,

I`m now working on modable game. As part of it - images maybe there, or maybe not. They could be in different folders. That generates a tons of warnings - that flooding my console =(

Does it possible to turn that off?

You could just check whether the file exists before trying to loading it.

https://docs.coronalabs.com/api/library/system/pathForFile.html

Yeah,  your best choice is to check if it exists and if not, don’t use it as a fill.  
 
You can’t turn off console warnings. :frowning:
 
I have io.* extensions in SSK, among which is:

io.exists( fileName [, base] )

-- WORKS FOR FILES AND FOLDERS local lfs = require "lfs" function io.exists( fileName, base ) local base = base or system.DocumentsDirectory if( base ) then fileName = system.pathForFile( fileName, base ) end if not fileName then return false end local attr = lfs.attributes( fileName ) return (attr and (attr.mode == "file" or attr.mode == "directory") ) end 

if your files can be in resource directory also you need more checks:

function menu.fileExist(fileName, baseIn) local exists = false if fileName then local base = baseIn or system.ResourceDirectory if ( system.getInfo( "environment" ) ~= "simulator" ) and (base==system.ResourceDirectory) then exists = true else local filePath = system.pathForFile( fileName, base ) 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 = true fileHandle:close() end end end end return(exists) end

You could just check whether the file exists before trying to loading it.

https://docs.coronalabs.com/api/library/system/pathForFile.html

Yeah,  your best choice is to check if it exists and if not, don’t use it as a fill.  
 
You can’t turn off console warnings. :frowning:
 
I have io.* extensions in SSK, among which is:

io.exists( fileName [, base] )

-- WORKS FOR FILES AND FOLDERS local lfs = require "lfs" function io.exists( fileName, base ) local base = base or system.DocumentsDirectory if( base ) then fileName = system.pathForFile( fileName, base ) end if not fileName then return false end local attr = lfs.attributes( fileName ) return (attr and (attr.mode == "file" or attr.mode == "directory") ) end 

if your files can be in resource directory also you need more checks:

function menu.fileExist(fileName, baseIn) local exists = false if fileName then local base = baseIn or system.ResourceDirectory if ( system.getInfo( "environment" ) ~= "simulator" ) and (base==system.ResourceDirectory) then exists = true else local filePath = system.pathForFile( fileName, base ) 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 = true fileHandle:close() end end end end return(exists) end