anson@spray.CalComp.COM (Ed Anson) (11/18/88)
I have recently noticed a problem, which has probably been around for a long time. This is a warning to developers, so that it can be avoided in the future. Some applications which use MacinTalk (or other drivers) fail to work (i.e., bomb) when the application is not on the boot disk. The reason is simple, and the cure is almost as simple. The glue provided for opening drivers such as MacinTalk simply does an OpenResFile for the file containing the driver, followed by an OpenDriver using the file refNum returned. The problem is that OpenResFile doesn't always find the file. Why? If the application is on a different disk from the System file, the System folder is not searched for the file in the same way as it is if the application is on the boot disk. This is documented by the fine print in Inside Mac IV-101. Most applications fail to check for this, and wind up bombing at the first attempt to access the driver. With the increasing use of multi-disk and partitioned disk systems, this will be an increasing problem. I have seen at least one popular commercial product (which I won't name here) fail for this reason. There are three solutions to this problem: 1. Warn users to place the driver in the same folder as the application, if it is on a separate disk from the System folder. This side-steps the problem, but is an unusual practice. 2. A better solution is to set the working directory to the System folder just prior to opening the driver. Then set it back to what it was. This works in all cases. 3. Apple could modify the search path to include the System folder, even when on a separate disk. Frankly, the other two solutions are more likely. :-) -- ===================================================================== Ed Anson, Calcomp Display Products Division, Hudson NH 03051 (603) 885-8712, anson@elrond.CalComp.COM