Save Data to stack inside Standalone - Broken?
Jim Bufalini
jim at visitrieve.com
Mon May 4 06:18:43 EDT 2009
Hi Sivakatirswami,
> You got it! Problem solved:
Great.
> go stack url "binfile:lexicon.rev" = bogus... I think we did that in
> another project where the stack would not open properly... can't
> remember why we need to use the url binfile format to get the stack to
> open.
>
> But, it was doing exactly like downloading from the web...
> open in ram but no file name.
>
> This works now...
>
> on loadFromDisk #start up handler
> set itemdel to "/"
> set the defaultfolder to item 1 to -2 of the effective filename of
> this stack
> --go stack url "binfile:lexicon.rev" #doesn't work
> go stack (the defaultfolder&"/lexicon.rev") # now it will save!
> hurray...
> hide stack "MahaLexiconLoader"
> end loadFromDisk
One more gotchya to look out for when constructing fully qualified file
paths for cross-platform development. I gave the example I did because you
said, in answer to one of my questions, that you were on a Mac. Then I read
in a post you made to another list that you must be developing for
cross-platform. Either that, or you've made a significant dent into the Mac
market. ;-)
Using the default folder or item 1 to -2 of the filename of stack... tends
to work fine cross-platform, where Rev is handling the translation. But, as
soon as you start hard coding slashes (as in your and my example), you can
run into issues on different platforms for different commands. PCs don't
like slashes and servers don't like backslashes. ;-) So best to be safe and
have something like this:
Global gfd -- for file delimiter
IF the platform = "MacOS" OR the platform <> "Win32" THEN
put "/" into gfd
... Any other platform specifics like fonts.
Else
Put "\" into gfd
... same
End if
Then hardcode slash (/) as you did above. But, right before doing file
manipulations, put a:
Replace slash with gfd in <tFullyQualifiedFilePath>
This will save you from scratching your head over "file not found" errors.
It also allows you to use *set itemdel to gfd* without having to think. ;-)
Of course, always use slash (/) when addressing servers, regardless of what
the desktop platform is.
> It's been raining here on Kauai since last October, and only last week
> did it stop.
> I was so happy to see dust coming up from the tractor when I went out
> to
> mow the fields finally!
It's a lot wetter there. ;-) I think we've had one day of solid rain here
(outside of the occasional "liquid sunshine" sprinkles during the day) in
the past few weeks. Then again, the only fields I have are in Rev. ;-) Is
plowing fields why you invited me to visit? ;-)
Aloha from a sunnier Island of Hawaii, ;-)
Jim Bufalini
More information about the use-livecode
mailing list