[futurebasic] Re: [FB] [FBII] filepath => wdRefNum%

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

From: Alain Pastor <apastor@...>
Date: Tue, 14 Dec 1999 10:41:30 +0100

Michael Evans wrote:

> > Michael Evans wrote:
> >
> >> help...
> >>
> >> I'm on the road and I don't seem to have an FN I got from somewhere that's
> >> something like:
> >>
> >> CLEAR LOCAL
> >> LOCAL FN filePathToWDrefNum%(FullFilePath$)
> >>   DIM wdrefNumfromFP%
> >>   '??????
> >>
> >> END FN = wdrefNumfromFP%
> >>
> >> and called like this:
> >>
> >> myWD% = FN filePathToWDrefNum%(FilePath$)
> >>
> >> Can anyone supply it or point me to it?
> >>
> >> TIA
> >>
> >
> > Michael,
> >
> > Have a look at : http://www.pixmix.com/FB/HowTo/DISK/DISK004.html
> > Cheers
> >
> > Alain
> >
> >
> > --
> > To unsubscribe, send ANY message to <futurebasic-unsubscribe@...>
> >
>
> I tried the second fn. It does not work returning a -120 error. The file
> path I'm testing is a valid path to a file on a CD. Norton's said The CD is
> ok
>
> and the following fn says the file exists with the identical filepath:
>
> '=========================================
> CLEAR LOCAL
> LOCAL FN filePathExists(afilePath$)
>   '---------------------------------------
>   DIM fileExists
>   DIM pBlk.ioHFQElSiz
>
>   pBlk.ioVRefNum  = 0
>   pBlk.ioNamePtr& = @afilePath$
>   LONG IF FN HGETFILEINFO(@pBlk) = _noErr
>     fileExists = (pBlk.iocompletion% = _noErr)
>   XELSE
>     fileExists = _false
>   END IF
>
> END FN = fileExists
>

Michael,

I went to quickly read again the web page in the pouch, and it appears
that the
function you have grabbed was not tested by the poster, Eric Bennett (that's
what he said). I left it in the page because the general discussion started
around this function. I left also Ricks' note telling it is more likely
going to fail
for some raison.
Maybe you should try to build a function using Rick's first solution
with the
FOLDER statement. It should be something like this:


CLEAR LOCAL
LOCAL FN GetWDFromPath(fullPath$)
         DIM wdRefNum%,oldDefault%,dummy%

          oldDefault% = FOLDER("", 0) 'Save old default
          wdRefNum%   = FOLDER(fullPath$, 0)
          dummy%      = FOLDER("", oldDefault%) 'Restore old default

END FN = wdRefNum%

If you need to work with the mini runtime (the FOLDER statement doesn't work
with the mini runtime), go to the pouch again, you'll find a function that
emulates this statement in such a case. That one was sent to the list by Staz,
last year.
HTH

Cheers

Alain