Relative Paths in Property Inspector

Sannyasin Brahmanathaswami brahma at hindu.org
Sun Oct 29 15:02:00 EDT 2017


Backstory:

Sometime back in a round with HQ we got the engine to "remember" relative path settings for the filenames of images/players etc.. such that it would not default to full path from root on the drive which makes the path unique to that user and no longer portable… so "relativity" go supported/sticky in different dev scenarios…

so far so good… if you set the filename in an image in a stack that lives here:

User/MyDrive/myProject/coolAnimals.livecode

with images here to:

User/MyDrive/myProject/img/thumbs/little-rooster.jpg

# it, obviously works But, now you can

a) manually chop of the lead down to this in the property inspector

img/thumbs/little-rooster.jpg

# and it works… this is also portable if you include "img/*" in the stackfiles when create your standalone and the filename is saved relative to the stack, and, assuming you keep the folder structure intact you don't have to even mess with defaultfolder or even specialFolderPath("engine")  because the "relativity" of the path is respected in any and all contexts (I think…)

so you can also programatically do this

set the filename of img "myPet" to "img/thumbs/little-rooster.jpg"

and that also works  though you do need to use "specialFolderPath" functions on mobile.

Again, so far so good…

End backstory (please correct anything you see that is wrong)

So, why can't we just a relative path in the Property Inspector itself? The browser tool will always return full path from User down to the "asset.jpg"… if I send that stack to someone else, or use a GIT work flow where these stacks are "pure views" (i.e. no actual imported images anywhere)  along with the images. the paths are broken.  So, long way of asking:

Do we need an enhancement request for a check box in the PI to set the path as relative to the stack? Seems like that would be super usefu

Mikey has this request in since May '16… which feels related

http://quality.livecode.com/show_bug.cgi?id=17705

but the suggestion for having this in the PI seems a bit different, and might not actually solve his issue for using a cloud instance of his project.

Brahmanathaswami







More information about the use-livecode mailing list