I've been using OS_File,17 to check for the existence of files, in fact
here's the exact bit of code:
DEF FNcheckfile(file$)
LOCAL spec%, flags%
SYS "OS_File",17,file$ TO spec%;flags%
IF (spec%=0) OR ((flags% AND 1)=1) THEN file$="No Info"
=file$
I have just discovered, however, that this fails if file$ contains an
unknown path, for example: "wibble:no.file.here"
If fails in that it /doesn't/ identify the lack of a file. spec% is set to
some large number and the SWI doesn't generate an error.
Can anyone else repeat this, and if so, what's the solution?
Thanks,
Adam
P.S. RISC OS 4.39
--
Adam Richardson Carpe Diem
http://www.snowstone.org.uk/riscos/
Works OK here, RISC OS 5.09 (no error, spec%=0). Could be a Select bug -
maybe it's trying to return an error and forgetting to set the V flag. Does
it look like R0 (spec%) is pointing to an error block? E.g.
SYS "XOS_GenerateError", spec%+4 TO err$
PRINT err$
I vaguely recall that select does lots of extra canonicalising that RISC OS
5 doesn't so it may be losing the V flag somewhere in the OS_File 17 handler.
Steve
--
Steve Revill @ Home
Note: All opinions expressed herein are my own.
> I've been using OS_File,17 to check for the existence of files, in fact
> here's the exact bit of code:
> DEF FNcheckfile(file$)
> LOCAL spec%, flags%
> SYS "OS_File",17,file$ TO spec%;flags%
> IF (spec%=0) OR ((flags% AND 1)=1) THEN file$="No Info"
> =file$
> I have just discovered, however, that this fails if file$ contains an
> unknown path, for example: "wibble:no.file.here"
You need SYS "XOS_File" otherwise flags% isn't set.
Ian
--
Ian Hamilton (RISC PC RO4) http://www.hamiltoni.pwp.blueyonder.co.uk/
(Iyonix RO5) Programs compatible with RISC OS 3/4/5
> I've been using OS_File,17 to check for the existence of files,
> in fact here's the exact bit of code:
> SYS "OS_File",17,file$ TO spec%;flags%
Try making that SYS "XOS_File",17,etc
^
VinceH
Ooops, that's just a typo. My "real" routine does use XOS.
Adam
> In article <db8a7903...@snowstone.org.uk>,
> Adam <ne...@snowstone.org.uk> wrote:
> > Hi,
> >
> > I've been using OS_File,17 to check for the existence of files, in fact
> > here's the exact bit of code:
> >
> > DEF FNcheckfile(file$)
> > LOCAL spec%, flags%
> > SYS "XOS_File",17,file$ TO spec%;flags%
> > IF (spec%=0) OR ((flags% AND 1)=1) THEN file$="No Info"
> > =file$
> >
> > I have just discovered, however, that this fails if file$ contains an
> > unknown path, for example: "wibble:no.file.here"
> >
> > If fails in that it /doesn't/ identify the lack of a file. spec% is set to
> > some large number and the SWI doesn't generate an error.
> >
> > Can anyone else repeat this, and if so, what's the solution?
> >
> > P.S. RISC OS 4.39
>
> Works OK here, RISC OS 5.09 (no error, spec%=0). Could be a Select bug -
> maybe it's trying to return an error and forgetting to set the V flag. Does
> it look like R0 (spec%) is pointing to an error block? E.g.
>
> SYS "XOS_GenerateError", spec%+4 TO err$
> PRINT err$
"Filing system or path wibble: not present"
So is that a yes? Would checking if spec%>3 be a workable solution?
Thanks,
Adam
Yes, that looks like an OS bug and yes, your work-around will do the job.
It's a rather heavily-used routine so that's quite a worrying bug to have
kicking around (easy to fix though, I'd imagine).
:)
I can't reproduce this with Adjust. Bit 0 of flags% is set and spec%
points to error block "Filing system or path wibble: not present".
John.
> OS_File,17
> If fails in that it /doesn't/ identify the lack of a file. spec% is set to
> some large number and the SWI doesn't generate an error.
Thanks to some help from John Tytgat I've discovered that the problem is
not, indeed, with the OS, but a module which I've got running here which
sits on the OS_FileV vector.
The module in question is "iSV General RiscOS4 patch" and is present in my
boot sequence (!Boot.Choices.Default.Boot.Tasks.iSV Patch). I didn't put it
there though so I suspect it is part of the Virtual RPC default disc image.
Does anyone know what it's for? I'll mention this on the VA forum too...
Adam
Now you mention it, I found this bug and tracked it down then reported it to
Virtual Acorn in July last year. I didn't hear anything much back from them
about it though.
I can't believe I forgot all about it! For those who are interested, here's
what I sent to them...
On 13 Jun, Steve wrote:
> Hi,
>
> I'd like to report a couple of faults/niggles with VirtualRPC SE. The
> first, and probably most serious is a HostFS bug which causes OS_File 17
> (and the like) to report back garbage for some wildcarded pathnames.
>
> For example:
>
> OS_File 17 !Boot.!Run.* will return junk as an object type (R0). In fact,
> it's not junk; it's a pointer to an error block in the HostFS module for
> the "Not found" error but the V flag has not been set. This should return
> an object type of zero.
>
> For an empty directory, the conventional test is OS_File 17 emptydir.*
> which should return an object type of zero. In fact, it returns 2
> (directory).
> In message <db8a7903...@snowstone.org.uk>, Adam wrote:
>
> > OS_File,17
>
> > If fails in that it /doesn't/ identify the lack of a file. spec% is set to
> > some large number and the SWI doesn't generate an error.
>
> Thanks to some help from John Tytgat I've discovered that the problem is
> not, indeed, with the OS, but a module which I've got running here which
> sits on the OS_FileV vector.
>
> The module in question is "iSV General RiscOS4 patch" and is present in my
> boot sequence (!Boot.Choices.Default.Boot.Tasks.iSV Patch). I didn't put it
> there though so I suspect it is part of the Virtual RPC default disc image.
Some old patch to EasyFontPro, perhaps. That certainly sites on FileV
et al to do its work. I know, having hacked it up to make sure it
worked under RISC OS 5.
--
Peter Naulls - pe...@chocky.org | http://www.chocky.org/
----------------------------------------------------------------------------
RISC OS: Be Informed | http://www.riscos.info/