Where's the file?

Klaus Major klaus at major-k.de
Tue Dec 23 07:31:23 EST 2008


Hi Timm,

> Hello all...
>
> This strikes me as odd.  I frequently use text files as containers  
> of data (prefs, and the like) in my stacks.  On openStack, I put the  
> path of the folder containing the stack into a global so I can use  
> it later.  Not a problem when I'm running as a stack...text files  
> are created and modified as expected during use (I use get/put URL).
>
> put "Whatever" into url ("file:"&appFolderPath&"HereIAm.txt")
> get url ("file:"&appFolderPath&"HereIAm.txt")
>
> When I open the text file later with a text editor, I see what I  
> expect to see.
>
> However, when I make a standalone app of the stack, I no longer see  
> the text files in the folder.  Are these text files being set as  
> "invisible" in the finder?

No, but your files can be found INSIDE of the application bundle :-)

"the path of the folder containing the stack" is this one in a  
standalone on OS X:
../Name_of_your_standalone.app/Contents/MacOS/

Your text files can be found in this folder!
Right-Click on your standalone and select "Show contents" to check it  
out

> I'm running Enterprise 2.8.1 in OSX 10.5.6.

You will have to take this into account when initializing your global  
variable:

...
put the filename of stack "Mainstack a.k.a. the standalone" into  
tFilename
set itemdel to "/"
if the platform = "MacOS" then
    delete item -4 to -1 of tFilename
else
   delete item -1 of tFilename
end if

global appFolderPath
put tFilename & "/" into appFolderPath
...

You get the picture :-)

> Best Regards,
>
> Timothy R. Ponn

Regards

Klaus Major
klaus at major-k.de
http://www.major-k.de





More information about the use-livecode mailing list