Set Image Reference to Relative Path
J. Landman Gay
jacque at hyperactivesw.com
Mon Apr 4 02:01:06 EDT 2016
On 4/3/2016 10:40 PM, Sannyasin Brahmanathaswami wrote:
> Am I the only one that thinks a great enhancement would be to insert a relative path?
>
> OR do we have a but where that should be the default behavior. Why?
Relative paths have been around for a while and are pretty much
imperative for app distribution, since the user's filepaths won't be the
same as your development paths.
It used to be that resources were copied into the same folder with the
app executable. Then Apple changed the rules and disallowed resources
like images and documents at that location. Instead, they had to go into
a "resources" folder, separate from the executable.
To accomodate, LC now has a new-ish specialFolderPath("resources").
During development it points to the same folder as the mainstack you're
working on; after the app is built, it points to the "resources" folder
inside the app bundle. In scripts, build file paths to
specialFolderPath("resources") and the paths will always resolve
correctly before and after compiling. For image references use
"resources/imgname.png".
To accomdate legacy script and image references, the LC engine
automatically translates any relative paths and redirects them to the
resources folder. On non-Apple systems this structure isn't strictly
required, but since it works everywhere, it's an easy way to be
consistent cross-platform.
--
Jacqueline Landman Gay | jacque at hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
More information about the use-livecode
mailing list