relative path to stack in send

Sarah sarahr at genesearch.com.au
Wed Oct 29 23:18:47 EST 2003


The way I implement relative paths is to have a function that returns 
the full path to the folder of the mainStack. Then I can have a 
function that appends the path for my substack, media file etc. to that 
overall path.

e.g.
mainStackFolderPath()
	-- in the stack script of my main stack
	-- uses "the fileName of this stack", then deletes the stack file name
	-- returns "E:/users/home/rees-j/projects/hypercard/practice/"
relativePathTo("Gurobaru.rev")
	-- uses mainStackFolderPath()
	-- returns 
"E:/users/home/rees-j/projects/hypercard/practice/Gurobaru.rev"
relativePathTo("images/photo1.jpg")
	-- uses mainStackFolderPath()
	-- returns 
"E:/users/home/rees-j/projects/hypercard/practice/images/photo1.jpg"

Cheers,
Sarah

On Wednesday, October 22, 2003, at 12:36  pm, Joel Rees wrote:

>>> None of these seem to work:
>>>
>>>     send "gimmeSomeOThatStuff" to stack "../Gurobaru stack.rev"
>>>     send "gimmeSomeOThatStuff" to stack "file:../Gurobaru stack.rev"
>>>     send "gimmeSomeOThatStuff" to stack URL "file:../Gurobaru 
>>> stack.rev"
>>>
>>> This works, but only if Gurobaru stack is already open:
>>>
>>>     send "gimmeSomeOThatStuff" to stack "Gurobaru stack"
>
> Forgot something here. What works if Gurobaru stack is not open is
>
>     send "gimmeSomeOThatStuff" to stack 
> "E:/users/home/rees-j/projects/hypercard/practice/Gurobaru stack.rev"
>
<snip>
>
> It would be nice to be able to use relative path, if anyone knows how.



More information about the Use-livecode mailing list