[futurebasic] Re: [FB] files$ in fb^3

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

From: Alain Pastor <apastor@...>
Date: Sun, 20 Aug 2000 14:50:40 +0200

James Tolchard wrote:

> On 20/8/2000, AlStaff@... said:
>
> >Try using SYSTEM(2)
> >
> >SYSTEM(1) returns a working directory reference number for the folder that
> >contains the application file.
> >
> >SYSTEM(2) returns a working directory reference number for the System folder.
>
> Oops, sorry. That was a typo on my part. My point was that no matter what I
> specify for wdRefNum%, I *always* get listings of the root directory of my
> hard drive.
>
> Any more suggestions?
>
> Thanks alot.
>
>

Hi James,

As a workaround maybe you could do something like this:

CLEAR LOCAL MODE
DIM pBlock.128
DIM dirName AS STR63
DIM pathName AS STR255
DIM err AS OSErr

LOCAL FN GetPathname$ (fName AS STR255, vRefNum AS INT)

  pathName = fName
  pBlock.ioNamePtr&      = @dirName
  pBlock.ioVRefNum%      = vRefNum
  pBlock.ioDrParID&      = [_curDirStore]
  pBlock.ioFDirIndex%    = -1

  DO
    err = FN GETCATINFO (@pBlock)
    LONG IF err = _noErr
      pathName =  dirName + ":" + pathName
      pBlock.ioDrDirID& = pBlock.ioDrParID&
    END IF
  UNTIL pBlock.ioDirID& = _fsRtParID

END FN = pathName
// Main
DIM AS INT    idx,vRefNum
DIM AS STR255 itemName,sysFldName

WINDOW 1

sysFldName = FN GetPathName$("",SYSTEM(_sysVol))

DO
  idx++
  itemName = FILES$(-idx,,sysFldName,vRefNum)
  PRINT itemName
  UNTIL itemName[0] = 0

DO
UNTIL FN BUTTON

Cheers

Alain