Relative Paths

Richard Gaskin ambassador at fourthworld.com
Wed Apr 7 19:32:40 EDT 2004


J. Landman Gay wrote:
> You can use relative paths. Unfortunately the IDE doesn't have an 
> interface to set them. You'll have to make your own.

Has that been Bugzilla'd?  It sounds like a valuable feature enhancement 
request.

> One way is to make a list of stackfiles in a field. For example, put 
> this into a field named "stacks":
> 
> mystack,/subDir/mystack.rev
> stackTwo,/subDir/stackTwo.rev
> stackThree,/otherDir/stackThree.rev
> 
> Then from the message box:
> 
> set the stackfiles of this stack to field "stacks".
> 
> Ungainly, but it works.
> 
> Note that, as Ken explained, all directories are relative to the current 
> defaultfolder.

There are two conventions at play: for stackFiles paths are relative to 
the stack that references them, while external media paths are relative 
to the defaultFolder.

While the default folder is initialized to be the same as the location 
of the executable on all systems (except OS X, see next paragraph), the 
defaultFolder can be changed while the starting point for referencing 
stackFiles cannot.

These differences are compounded by yet-another-Apple-anomaly:  with OS 
X bundles the defaultFolder is initialized to the folder the *.app 
bundle is in, while stackFiles are relative to the executable within the 
bundle.

So for OS X, unless you move your external stacks inside the bundle 
(altering the path from what it had been in development, altering the 
user experience across platforms, and thereby requiring forked 
documentation for your product) you'll need to prepend your stackFiles 
to accomodate Apple's break from convention:

   on startUp
     ResetStackFiles
   end startUp

   on ResetStackFiles
      get fld "MyStackFiles"
      if isOSX() then
      repeat with i = 1 to the number of lines of it
          put "../../" before item 2 of line i of it
      end repeat
      set the stackFiles of this stack to it
   end ResetStackFiles

   function isOSX
     set the itemDel to "."
     return (item 1 of the systemVersion >=10)
   end isOSX


Given these factors, is having these two conventions more useful than 
confusing?

Should we consider changing the stackFiles relative starting point in OS 
X to match that of all other platforms, and/or having both stackFiles 
and media references use the same logic?

And other than moving all of your work into the Revolution application 
folder, what else can be done to simplify differences between the 
initial value of defaultFolder during development and its intial value 
in a standalone?

--
  Richard Gaskin
  Fourth World Media Corporation
  ___________________________________________________________
  Ambassador at FourthWorld.com       http://www.FourthWorld.com


More information about the use-livecode mailing list