I would like to be able to display an image from any arbitrary directory on the Windows machine. I am reading a complete filepath from a text file and using that in display.newImage, but I keep getting a warning telling me that my program could not find the image at that location. I know that display.newImage can only load images from specific locations which are contained in directory constants (system.ResourceDirectory, system.CacheDirectory, system.DocumentsDirectory, etc.), so I was wondering if there was anyway for me to reference the absolute root folder of the system using standard Lua and Corona SDK API’s.
An alternate solution I think could work is to create a temporary directory constant to use for a particular instance. If anyone knows the structure of a directory constant, I might be able to work this out using that.
Like I’m sure you’ve already noticed, display.newImage() and other similar functions are limited to loading files from Corona’s “sandboxed” directories: ResourceDirectory, CachesDirectory, TemporaryDirectory, and DocumentsDirectory. Absolute paths will not work.
The only other solution that I can think of that will work *today* is to copy the file to one of these sandboxed directories yourself via our file io APIs.
Unfortunately no. This is a limitation in Corona to make it compatible on sandboxed platforms such as iOS.
If it’ll help you any, the following guide shows you how to copy a file in Lua. The standard Lua io.* APIs will accept paths outside of Corona’s sandboxed directories.
Like I’m sure you’ve already noticed, display.newImage() and other similar functions are limited to loading files from Corona’s “sandboxed” directories: ResourceDirectory, CachesDirectory, TemporaryDirectory, and DocumentsDirectory. Absolute paths will not work.
The only other solution that I can think of that will work *today* is to copy the file to one of these sandboxed directories yourself via our file io APIs.
Unfortunately no. This is a limitation in Corona to make it compatible on sandboxed platforms such as iOS.
If it’ll help you any, the following guide shows you how to copy a file in Lua. The standard Lua io.* APIs will accept paths outside of Corona’s sandboxed directories.