get specialFolderpath(26)

Rob Cozens rcozens at pon.net
Tue Oct 15 12:48:01 EDT 2002


>I am looking for a suitable folder for use with Windows, one which
>would be on all systems.

How about the folder containing your Revolution app?

   get the effective fileName of me
   set the itemDelimiter to "/"
   put yourPreferenceFileName into item -1 of it
   if there is not a file it then
     beep
     answer "Please install the 
file,"&&quote&yourPreferenceFileName&quote&&"in my folder and try 
again."
     close this stack
     exit preopenStack
   end if

Then it doesn't matter what the folder name or folder path is or 
whether you're installed on drive C or drive W...just specify the app 
& the preferences file must reside in the same folder.

My rewrite of SDB from HyperTalk to Transcript began life storing 
full path names to databases.  It tested fine on my static platform; 
but as I got to the end of testing and began to consider packaging & 
deployment, it quickly became evident that that design was vulnerable 
to failing if the db, the mainstack, and/or the folder they resided 
in were moved.  Placing individual files and/or folders in the same 
folder as the main app frees one from having to deal with these 
issues.

Frankly, it annoys me to have to open an Attachments folder inside a 
Eudora folder inside my System folder to retrieve attachments.  Why 
couldn't Eudora put the attachment in the main Eudora folder I 
already have open (or in an Attachments folder in that folder)?

Suppose your Mac app is installed on one hard drive and later moved 
to another drive or partition, or the name of the drive or one of the 
folders in the path is changed. Yes, specialFolderpath can still find 
your Preferences file; but if your user buys a new computer and loads 
your app from its current computer instead of reinstalling from 
scratch, will they know to move the Preferences file?

Think relative!

However, if you feel the above is just fooleshness, the Rev 
Dictionary gives you these choices for specialFolderpath:

For Windows systems:
	Desktop: For icons on the desktop
	System: For system components
	Start: For items in the Start menu
	Documents: For user documents
	Fonts: For font storage
	Temporary: For storage of temporary files

 From this list, I would suggest Documents if the Preferences file is 
permanent, or Temporary if it is created at runtime & deleted at 
program shutdown.
-- 

Rob Cozens
CCW, Serendipity Software Company
http://www.oenolog.com/who.htm

"And I, which was two fooles, do so grow three;
Who are a little wise, the best fooles bee."

from "The Triple Foole" by John Donne (1572-1631)



More information about the use-livecode mailing list