images and path names

J. Landman Gay jacque at hyperactivesw.com
Mon Sep 3 13:42:56 EDT 2012


On 9/2/12 9:24 PM, Timothy Miller wrote:
> If I set the "source" of an image in its inspector by clicking on the
> little file icon and selecting the file from the dialog box, the
> source field in the inspector shows "./test.image.jpg"
>
> Same thing happens with File menu: New referenced control: Image
> file...
>
> Yet if I write a script:
>
> import paint from file "./test.image.jpg"
>
> I get an error, presumably because the path name of the image is
> incorrect.

It's Unix file paths. The dot means "this folder". The IDE is creating a 
path relative to the stack file.

If you set the defaultfolder to the one holding your stack, the relative 
path import should work.

>
> On the other hand, the script:
>
> import paint from file "/users/Daddy/Documents/Rev Documents/project
> images/test.image.jpg"
>
> does work.

Full filepaths always work.

>
> Yet, if I paste
>
> /users/Daddy/Documents/Rev Documents/project images/test.image.jpg
>
> Into the "source" field of the inspector for an image, the image
> doesn't display.

The IDE is trying to "help" by making whatever you paste into a relative 
file path. It's looking for a folder inside the stack's folder named 
"users/etc". Generally this is okay because it allows you to move the 
enclosing stack folder from one place to another without breaking the paths.

I think if you turn on the "Files & Memory" preference that uses 
absolute file paths, pasting the full path into the inspector will work 
and you'll also see full file paths when you choose a file from within 
the inspector.


-- 
Jacqueline Landman Gay         |     jacque at hyperactivesw.com
HyperActive Software           |     http://www.hyperactivesw.com




More information about the use-livecode mailing list