path to the stack?

Sarah Reichelt sarahr at genesearch.com.au
Mon Jul 4 21:51:27 EDT 2005


> I'm trying to create a text file that will be the prefs file for a  
> standalone. I'm running this script on a development stack under  
> rev 2.6 on Mac OS X 10.4.x and getting nothing back:
>
> put the filename of this stack into thePath
>
> thePath stays empty after that runs.

Is "this stack" the mainStack or a sub-stack? A sub-stack does not  
have a file path.
This line will always work:
   get the filename of stack (the mainStack of this stack)
>
> My plan was to take this absolute path, replace the name of the  
> stack with the name of my prefs file, and then store the prefs file  
> in the same directory as the stack so that under all platforms it  
> would be stored in a known location. This script above is almost  
> exactly taken word for word from the example in the documentation  
> shown below.
>
> put the filename of stack "My Main" into thePath
>
> 1. Why isn't this working?
> 2. Does anyone have a sample script for putting a prefs file in a  
> known location that does work that I could use?
> 3. Will I need to watch out for a path that is inside the package  
> contents for the standalone (if I get that far in my coding)?

Have a look at my recent article in revJournal about saving data:
<http://www.revjournal.com/tutorials/saving_data_in_revolution.html>

I recommend using the specialFolderPath("Preferences") to store your  
prefs file, but if you use the fileName method above to locate your  
stack file, in an OS X bundle, you will get the path to the Contents/ 
MacOS folder inside the bundle. This can be a problem if the user  
doesn't have admin privileges and can't write to the Applications  
folder.

HTH,
Sarah




More information about the use-livecode mailing list