[futurebasic] [FBII] [PG:PRO] Differentiating between File, Folder, Volume Aliases

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

From: "Michael Evans" <mikonic@...>
Date: Wed, 30 Jun 1999 10:53:40 -0400
I have been using the following code, which works ok, for obtaining a 
wdRefNum% from an alias, as long as I know in advance whether the alias is
for a file, folder or volume.

A situation has arisen where I don't know whether the alias is to a folder
or a volume. Is there some simple way to detect whether an alias is to a
volume or to a folder?

(FN useAlias is from PG:PRO)

'===========================================================================
CLEAR LOCAL
DIM pBlk.54
DIM osErr%
LOCAL FN getWDRefNum(dirID&,volRef)
'===========================================================================
  pBlk.ioNamePtr&       = 0
  pBlk.ioWDDirID&       = dirID&
  pBlk.ioVRefNum        = volRef
  pBlk.ioWDProcID&      = _"ERIK"
  osErr% = FN OPENWD(@pBlk)
END FN = pBlk.ioVRefNum

'===========================================================================
CLEAR LOCAL
LOCAL FN myGetWDrefNumFromAlias%(theAliasNum%, itemType%)
  '=========================================================================
  DIM fSpec;0, fVrefNum%, fParID&, 63 fileName$
  DIM myErr%, WDRefNum%, ParWDRefNum%

  myErr% = FN useAlias(theAliasNum%,fSpec)

  LONG IF myErr% = _noErr
    SELECT itemType%
      CASE _isFile
        WDRefNum% = FN getWDRefNum(fParID&,fVrefNum%)
      CASE _isFolder
        PARENTID = fParID&
        ParWDRefNum% = FN getWDRefNum(fParID&,fVrefNum%)
        WDRefNum% = FOLDER(fileName$, ParWDRefNum%)
      CASE _isDisk
        WDRefNum% = FN getWDRefNum(fParID&,fVrefNum%)
    END SELECT
  END IF
END FN = WDRefNum%

Thanks,


----------------------------------------------------------
Michael Evans
Manager of Software Development * Photo Systems, Inc.
3301 Wood Valley Road, NW * Atlanta, GA, 30327-1515
Voice: (404) 846-9386
Fax: (404) 240-0878 * Cell: (404) 229-3930
E-mail: evans@... * michael_evans@...
----------------------------------------------------------