FB II Compiler
Mount a volume on a network
Here's what I would do:
1. Get an alias resource that points to the server. The simplest way to do this is as follows (offline, not from within your pgm):
a. Mount the server (use Chooser, or however you normally mount it).
b. Make an alias file (highlight the server icon, then select "Make Alias" from the Finder's "File" menu)
c. Open the new alias file in ResEdit. You have to checkmark the "Use alias instead of original" box in ResEdit's Open dialog.
d. Copy the "alis" resource from the alias file into the file that contains your application's resources (that's the file that's mentioned in your program's RESOURCES command).
e. Just to play it safe, you might want to change the resource ID number of the copied resource to "128" or something higher. Resources with lower ID numbers are supposedly reserved for Apple's private use.
2. Add code to your program to open and resolve the "alis" resource that you just copied. The following lines will do it--you just need to supply the right ID number in "resID":
FN RESOLVEALIAS returns an fsSpec record for the server--but the really cool thing is, in your case, you can just throw that fsSpec away. The very act of resolving the alias automatically forces the server to be remounted. So, whenever you're in doubt whether the server is mounted, execute the above code. If the server was already mounted, nothing will happen. If it _wasn't_ mounted, FN RESOLVEALIAS will mount it.
aHndl& = FN GETRESOURCE(_"alis",resID)
LONG IF aHndl&
OSErr = FN RESOLVEALIAS(#_nil,aHndl&,fSpec,aChanged)
LONG IF OSErr
'(Alias couldn't be resolved--is the server down?)
'(Couldn't load the "alis" resource)