Legacy stack woes
Rob Cozens
rcozens at pon.net
Wed Jun 6 10:31:13 EDT 2007
Bless you, Jacque!
>I don't think there is such a property, but you can read the binary
>file to see the format. If it starts with "REVO" then it is the new
>format. But for what you are doing, I don't think you'll have to
>resort to this.
Thanks to you it was simple for me to create a menuItem and general handler:
on CheckStackFormat
answer file "Select the stack."
if the result is empty then answer "Legacy Format ="&&(formatIsLegacy(it))
end CheckStackFormat
function formatIsLegacy stackPath
put false into legacyFormat
if there is a stack stackPath then
open file stackPath for binary read
read from file stackPath for 4
close file stackPath
if it is not "REVO" then put true into legacyFormat
end if
return legacyFormat
end formatIsLegacy
>Go to preferences, "Files and memory" pane, and turn off the option
>that automatically adds the ".rev" extension. Also turn on the
>option in the same pane that preserves the stack file type when
>saving a legacy stack.
Thanks.
>I think a script would be the easiest way for the initial stack
>creation. For a single file:
>
>on mySave
> set the stackfileversion to "2.4"
> save this stack as <myFileName>
>end mySave
Is there ever a need to reset stackFileVersion?
>[snip]
>If the Rev preference is set to respect legacy stacks, you don't
>need to run a script at all after the stack has been saved the first
>time. Cmd-S will just work.
Cool!
Rob
More information about the use-livecode
mailing list