Robert Covington wrote: > I tried to run Compositor from the CD > ... when I quit, and it tried to write it's prefs on close, I got a > permissions error for File Ref 1 > CLEAR LOCAL > DIM pBlock;128 > DIM pBlk&;128 > DIM @CreateFlag,@Drive%,@DirID&,@prefWDRef% > Local Fn IsPrefsFolderThere > Drive% = 0 > CreateFlag = _kDontCreateFolder > > LONG IF FN > FINDFOLDER(_kOnSystemDisk,_kPreferencesFolderType,CreateFlag,Drive%,Dir > ID&) = _NoErr > pBlk& = @pBlock > pBlk&.ioVRefNum% = Drive% > pBlk&.ioWDDirID& = DirID& > #if Carbonlib > fn FBWDtoPBWD(@pBlk&) > #endif > IF FN OPENWD (pBlk&) = _noErr THEN prefWDRef% = pBlk&.ioVRefNum% > END IF > > END FN = prefWDRef% I'm sure you are aware that the code above is rather, er, skanky. Despite its incomprehensibility / ugliness / obsolescence, it does try to signal an error by returning zero. If you ignore the signal and proceed > OPEN "O", #1,_PrefFile$,,wdRef% with wdRef% = 0, you end up attempting to write to a file in the same folder as the app. And if the latter is in a read-only location such as a CD, further errors naturally follow. All routines that deal with files should detect errors, bail out on the first error, and return an error code to the calling routine. The caller, on seeing a code other than _noErr, should either present an alert to the user, or bail out and return the error code to *its* caller... You may like to consider the merits of replacing your antiquated method with something based on GetUserPrefsFileSpec. This shows the recommended usage of FindFolder in OS X to locate the user's preferences folder. '~'A ' CPU : Carbon '~'B local mode local fn GetUserPrefsFileSpec( prefFileName as Str255, prefSpec as ^FSSpec ) '~'1 dim as long @ dirID dim as short @ vRefNum dim as OSErr err err = fn FindFolder( _kUserDomain, _kPreferencesFolderType, _kCreateFolder, @vRefNum, @dirID ) if ( err == _noErr ) then err = fn FSMakeFSSpec( vRefNum, dirID, prefFileName, #prefSpec ) end fn = err dim as FSSpec prefSpec dim as OSErr err err = fn GetUserPrefsFileSpec( "Dumbo", @prefSpec ) select err case _fnfErr // the prefs file doesn't exist; you need to create it //... case _noErr // the prefs file already exists //... case else stop "GetUserPrefsFileSpec error " + str$( err ) end select Robert P.