Why doesn't this script work?

Eric Chatonet eric.chatonet at sosmartsoftware.com
Mon Nov 14 05:03:29 EST 2005


Hi Stephen,

If, as I think, you want to get the path to the folder of your  
standalone, just get its fileName property:

function AppFolderPath
   set the itemDel to slash
   return item 1 to -2 of the fileName of this stack
end AppFolderPath

And use it to access other folders:

put AppFolderPath() into tPath
set the itemDel to slash
put <folder name>  into item - 3 to -1 of tPath

Will return the right path to a folder placed at the root of the OS X  
bundle folder.
You will build another code for Windows from AppFolderPath()  
according to the folders architecture you chose :-)

Best Regards from Paris,

Eric Chatonet.

Le 14 nov. 05 à 04:14, Stephen Paul McNutt a écrit :

> Here's a script I use to set the defaultFolder property for a  
> standalone.  The part for OSX works perfectly, but the part for  
> Win32 doesn't.  I've placed all those answer commands in there to  
> check variable and property values as I go.
>
> local ldefaultFolder
>     if the environment <> "development" then
>       answer the platform
>       answer the defaultFolder
>       if the platform = "MacOS" then
>         put defaultFolder into ldefaultFolder
>         put "/Classroom Quizshow.app/Contents/MacOS" after  
> ldefaultFolder
>         set the defaultFolder to ldefaultFolder
>         answer the defaultFolder
>       end if
>       if the platform = "Win32" then
>         put defaultFolder into ldefaultFolder
>         put "/CQdata" after ldefaultFolder
>         answer ldefaultFolder
>         set the defaultFolder to ldefaultFolder
>         answer the defaultFolder
>       end if
>     end if
>
> Note that the answer command 5 lines from the bottom returns the  
> name of the correct folder I'm trying to make the defaultFolder,  
> but the answer command 3 lines from the bottom returns the same  
> thing minus "/CQdata".  What the heck?  I even copied  
> "ldefaultFolder" in the 5th line from the bottom and pasted it over  
> the same word in the 4th line from the bottom just to make doubly  
> sure I didn't have a typo.  Again, the MacOS part works as expected  
> and produced the proper defaultFolder property value for the OS X  
> standalone.

----------------------------------------------------------------
So Smart Software

For institutions, companies and associations
Built-to-order applications: management, multimedia, internet, etc.
Windows, Mac OS and Linux... With the French touch

Free plugins and tutorials on my website
----------------------------------------------------------------
Web site        http://www.sosmartsoftware.com/
Email        eric.chatonet at sosmartsoftware.com/
Phone        33 (0)1 43 31 77 62
Mobile        33 (0)6 20 74 50 86
----------------------------------------------------------------




More information about the use-livecode mailing list