Mac-standaloning problem

Sarah Reichelt sarah.reichelt at gmail.com
Tue Jan 6 23:43:21 EST 2009


> In my application for an electronic diary "Phenomenalog" (version
> 18.0.1) I am relating to 3
>
> folders: One for Backups, One for Screenshots and one for Parsings,
> placed a few levels above the standalone.
>
> I have been dealing with them through relative addresses as custom
> properties, which were OK
>
>  in Windows-standalones, but not in Mac standalones.
>
> I therefore shifted to another strategy, locating them in scripts ,
> where they are identified relative to effective filename of stack.
>
> Also this works smoothly in Windows standalones, but fails in
> Mac-standalones.

When you make a Mac standalone, what appear to the Mac user as a
single application file is actually a folder. If you are building on a
Windows computer, you will be able to see the folder structure as
follows:

My Application.app
    Contents
         Info.plist
         Mac OS
              Externals
              My Application
         PkgInfo
         Plugins
              (various support bundles)
         Resources
              (icns files & .proj folders)

So you can see that the actual application (including your stacks and
the Rev engine) is nested in the MacOS folder. This folder may also
include any sub-stacks that have been separated from the mainStack.

Assuming your application is on the standard Applications folder, then
the effective filepath of your main stack would be:
   /Applications/My Application.app/Contents/MacOS/My Application

when I expect what you want is:
   /Applications

Here is my function that gives the path to either the application or
the Rev stack, so it works in a standalone or in the IDE.

function applicationFolder
  put the effective filename of this stack into tFull
  put empty into tFolder
  set the itemdel to "/"
  repeat for each item i in tFull
    if i contains ".app" or i contains ".rev" then exit repeat
    put i & "/" after tFolder
  end repeat
  return tFolder
end applicationFolder

However you say you want to go a few levels above the standalone. If
the standalone is in the Applications folder, there is only one level
higher and that gets you to the root directory of the hard drive which
really should not be used for storing data folders. It would be better
to have a data folder in the user's Documents folder.

How about something like this:

put specialFolderPath("docs") into tDocsFolder
put tDocsFolder & "/My Application data" into tDataFolder
if there is not a folder tDataFolder then create folder tDataFolder

Then you can make your 3 separate folders in the data folder and
access them easily.

HTH,
Sarah



More information about the use-livecode mailing list