Used with system.pathForFile to create a path for retrieving files where all the application assets exist (e.g., image and sound files). This often called the "app bundle."
Note: You should never create, modify, or add files to this directory. Doing so will prevent the device from verifying the integrity of your application; in some cases the device will treat your application as malware and refuse to launch your application.
This property can also be used with other APIs requesting a "baseDirectory" as a parameter (e.g., display.newImage, display.save, media.playSound). The Resource directory is generally the default directory if no directory is specified.
In the Corona Simulator this will be in a sandboxed folder on a per-application basis.
Note: Unlike the /Documents and /tmp directories, the Resource directory is not viewable using "Show Project Sandbox" in the simulator.
path = system.pathForFile( filename, system.ResourceDirectory )
This example will read a "data.txt" file located in the assets directory (the same directory that has "main.lua").
local path = system.pathForFile( "data.txt", system.ResourceDirectory ) local file = io.open( path, "r" ) if file then -- nil if no file found local contents = file:read( "*a" ) print( "Contents of " .. path .. "\n" .. contents ) io.close( file ) end
None.
userdata
Returns a special userdata constant pointing to the App Bundle (assets) directory. (This is not a string.)
To restate what was mentioned above: The system.ResourceDirectory is where your main.lua file and generally all your asset (resource) files are stored. For security reasons, this directory is made read-only and enforced by the operating system and not Corona. If you need to update something in the resource directory, you need to move it to the Documents or Temporary directories first.
oops, wrong url