Saving standalone substacks
J. Landman Gay
jacque at hyperactivesw.com
Wed Dec 16 22:22:04 EST 2009
Kay C Lan wrote:
> Because I can never figure out the differences between Windows set ups and
> Mac set ups, to lazy to keep track of the defaultFolder or whether I should
> be using a specialFolder, and am sure that someone (me most likely) is
> inadvertantly going to move a data stack to another location other than
> where my splash stack expects it to be, I've gone for a univeral, seems to
> work everytime, calculate the file path exactly before you need it approach:
Actually, I probably wasn't too clear. All that file path business was
mostly for opening files, not for re-saving them. Once they're open from
disk, the engine already knows the path, so "save this stack" is all you
need.
>
>
> put the long name of stack "myDataStack" into tFilePath
> --result is the full file path enclosed in quotes and preceded by the word
> stack
> --the first 7 char are: stack "
> --the last char is: "
> put char 8 to -2 of tFilePath into tFilePath --just the file path
> save stack "myDataStack" as tFilePath
You can get "the filename of this stack" to find out the path on disk
without any parsing.
That said, I do usually use your method (with the filename variation) to
find stacks whose relative locations are already known. I have a
function that returns filenames based on the standalone's location. I
should probably use the stackfiles property more than I do, it's an
automated way to do the same thing with less scripting.
Anyway, this is what I use. It goes into the standalone's mainstack script:
function appPath -- path to application folder
put the effective filename of me into tPath
set the itemdel to slash
return (item 1 to -2 of tPath) & slash -- on OS X this is INSIDE
the app bundle
end appPath
And then when I need to open a satellite stack:
go stack (appPath() & "stack1.rev")
--
Jacqueline Landman Gay | jacque at hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
More information about the use-livecode
mailing list