[futurebasic] Re: [FB] Question about opening directories.

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : March 2000 : Group Archive : Group : All Groups

From: "Pixmix (Alain)" <pixmix@...>
Date: Mon, 13 Mar 2000 16:05:08 +0100
Mark G wrote:

> The folllowing fn works when I omit the directory name, but
> tells me that it can't find the directory when I do in fact
> supply the directory name.  This is puzzling.  Could someone
> please explain why the PBOPENWD function works this way?
> I'm still getting used to the Mac file system.
>
> clear local
> dim pb.52,osErr%
> local fn FBOpenWD%(wd&,wdName$)
> ' For some reason this gives an error when you specify
> wdName$
> pb.ioNamePtr&=@wdName$
> pb.ioWDDirID&=wd&
> osErr%=fn openwd(@pb)
> long if osErr%
> call forecolor(_redColor)
> print "Error in FN FBOpenWD:";osErr%
> print "Wd&=";wd&
> print "wdName$=";wdName$
> end if
> end fn=pb.ioVRefNum%
>

Hi Mark,

Sorry if I have no answer for you on that point, but in case someone else is
interested, I faced the same problem with a similar function Rick offered to
the list a while back. The function is supposed to move a file to a given
directory. It failed to work in FB^3 until I put a nul string in the
DstFolderName$ variable, here is the function:

CLEAR LOCAL MODE
DIM MovePBRec.WDPBRecSize, Err%
DIM @ SrcVolRefNum%, SrcDirID&
DIM @ DstVolRefNum%, DstDirID&
LOCAL FN Move1File (SrcWDRefNum%, SrcFileName$, DstWDRefNum%, DstFolderName$)
'
    Err% = FN GetWDDirID (SrcWDRefNum%, SrcVolRefNum%, SrcDirID&)
    LONG IF Err% = _NoErr
        Err% = FN GetWDDirID (DstWDRefNum%, DstVolRefNum%, DstDirID&)
        LONG IF Err% = _NoErr
            LONG IF SrcVolRefNum% = DstVolRefNum%
                MovePBRec.ioNamePtr&   =@SrcFileName$
                MovePBRec.ioVRefNum%   = SrcVolRefNum%
                MovePBRec.ioDirID&     = SrcDirID&
                MovePBRec.ioNewName&   =@DstFolderName$
                IF DstFolderName$ = "" THEN MovePBRec.ioNewName& = _nil
                MovePBRec.ioNewDirID&  = DstDirID&
                Err% = FN PBCatMoveAsync(@MovePBRec)'toolboxes CatMove and
PBCatMove are missing
            XELSE
                Err% = _BadMovErr
            END IF
        END IF
    END IF
'
END FN = Err%

Cheers

Alain