[futurebasic] Re: [FB] Resfile problem

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : June 2003 : Group Archive : Group : All Groups

From: Robert Covington <artlythere@...>
Date: Thu, 26 Jun 2003 23:53:27 -0400
> I am having an -extremely-  irritating problem creating a resfile in  
> the preferences folder for OSX. When I check for the file as existing,  
> that returns affirmative, yet the file name doesn't show up in a  
> search. When I try to open it, I get a -1 result  from resRef% = FN  
> FSpOpenResFile (myFileSpec,_fsRdWrShPerm)
> Carbon// Appearance


Irritating problem may be solved...I tore my code out of my app to make  
a simple tester. Problems found:

When I rewrote my Exists checker and converted my whole Resfile area to  
OS X happier FSSpecs a way back at this point , I neglected to change  
the Long if....so it was trying to make when it should be trying to  
read, and vice versa.

Also compounding the problems was that after switching my file Exists  
checker to FB's, I was checking for true, when I should have been  
checking for _zTrue.

So, Be Ztrue to yourself.

My file is created now. Somehow.

So, my fault. Depending on which side of 0 you look at it.

  If was writing this portion of my app from scratch I wouldn't be  
having these problems. So If you can rewrite from scratch for X, I  
recommend such. Converting existing code makes for errors all too often  
and they can be more elusive than driving a new code car off the lot.  
Converting is often like putting a new body on an old car. Not all the  
bolts line up in the right places..and you have to go drill new holes,  
or remove bolts, or just stick on the old doors.

It ain't pretty. ;)

Thanks to those who replied offlist.

Robert
Author, "zTrue Tales of Programming Nightmares"

On Thursday, June 26, 2003, at 04:58  PM, Robert Covington wrote:

> I am having an -extremely-  irritating problem creating a resfile in  
> the preferences folder for OSX. When I check for the file as existing,  
> that returns affirmative, yet the file name doesn't show up in a  
> search. When I try to open it, I get a -1 result  from resRef% = FN  
> FSpOpenResFile (myFileSpec,_fsRdWrShPerm)
>
>
> Carbon// Appearance
>
> Example...
>
>
> CLEAR LOCAL mode
> DIM pBlk.ioHFQElSiz
> Local FN EhThatFileThere(@fNamePtr&,fVol,dir&)
> pBlk.ioNamePtr& = fNamePtr&
> pBlk.ioVRefNum% = fVol
> pBlk.ioDirID&   = dir&
> END FN = (FN HGETFILEINFO(@pBlk) = _noErr)
>
>
> CreateFlag = _kDontCreateFolder
>
> Long if FN  
> FINDFOLDER(_kOnSystemDisk,_kPreferencesFolderType,CreateFlag,Drive%,Dir 
> ID&) = _NoErr
> err% = FN FSMakeFSSpec ( Drive%, DirID& , "someFileName" , inSpec )
> End if
>
> go = FN EhThatFileThere("someFileName",Drive%,DirID&)
> // Stupid thing reports it exists...because of the FSSpec??
>
>
> FSpCreateResFile (  inSpec,_"wtvr", _"wtvr", _smSystemScript ) does  
> not work...
>
> "wtvr" is fictitious..
>
>
> I can never get a file to show up.
>
> Plea: Does Anybody have a set of FN's that Create a -resFile- in OS X  
> Prefs folder (I can do regular prefs files fine enough it seems) and  
> that also verifies it's existence so I can know when and where to  
> create it in the first place?  A regular file  thing with something  
> that adds a resource fork is fine too.
>
> This stuff compounded upon all the other #$# file stuff  in OSX I have  
> had to deal with about makes me want to throw the machine in the lake.
>
> Wondering: this file needs to be invisible...is that  a matter of just  
> using a period as the first letter in the name? Or is that System > only?
> rc
>
>
> --
> To unsubscribe, send ANY message to  
> <futurebasic-unsubscribe@...>
>