I have an application which starts by opening another file in order to
load some resources.
This file is meant to be in the application folder but users may, by
distraction, leave it in another folder.
My application starts then by looking for the extra file using
SYSTEM(_aplVol). If it is not there, it asks the user to locate the file
with FILES$. The new VolNum% is then saved in a Pref file for next time.
This seems to be a correct user-interface and it works fine but the
first time I run the application (thus without a Pref file) the
FileExists function returns _false on the VolNum% returned by
SYSTEM(_aplVol). Strangely enough the value returned by FILES$ is
identical.
Once the Pref file is created, everything runs smooth.
Furthermore, running the application from FB, then the compiled
application ends also in a file not found.
My FileExists function is received from one of you, on the List (sorry,
forgot who) and looks like this:
CLEAR LOCAL
LOCAL FN fileExists(fName$,fVol%)
DIM fileExists
DIM pBlk.ioHFQElSiz
pBlk.ioVRefNum = fVol%
pBlk.ioNamePtr& = @fName$
LONG IF FN HGETFILEINFO(@pBlk) = _noErr
fileExists = (pBlk.iocompletion% = _noErr)
XELSE
fileExists = _false
END IF
END FN = fileExists
Any idea where I go wrong?
Thanks in advance
Michel Verheughe