Could not find files in system.ResourceDirectory

  1. there is a function to detect whether file is on local

function FileUtil:doesFileExist( fname, path )

    local results = false

    local filePath = system.pathForFile( fname, path )

    if filePath then

        filePath = io.open( filePath, “r” )

    end

    if  filePath then

        – Clean up our file handles

        filePath:close()

        results = true

    end

    if results == false then

        LOG(“FileUtil:doesFileExist: “…fname…” not on local”)

    end

    return results

end

fname = xxxx

if FileUtil:doesFileExist( “res/ui/store_item/”…fname, system.ResourceDirectory  ) == true then

xxxx

end

Actually we have included files in the apk, but when call FileUtil:doesFileExist, it could not find the files on local.

  1. same issues when system.openURL(system.pathForFile(“help.html”, system.ResourceDirectory))

I’m using enterprise version 2015.2574.

Run in the real android device.

What’s the wrong?

Hi @mlhdyx,

Most likely, it’s because of the Android file restrictions which are outlined in this document:

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

Take care,

Brent

Hi @mlhdyx,

Most likely, it’s because of the Android file restrictions which are outlined in this document:

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

Take care,

Brent