|
Boost : |
From: Jeremy Maitin-Shepard (jbms_at_[hidden])
Date: 2003-12-08 14:30:46
Beman Dawes <bdawes_at_[hidden]> writes:
[snip]
> The floppy tests I ran this morning happened to use two brand-new diskettes from
> the same package. It looks like the formatter used by the manufacturer (Office
> Max store brand) didn't bother to assign a new volume serial number. So the
> bottom line is your code is OK, and so is Win XP. A warning in the docs about
> floppies would be in order, but that should be sufficient.
I suppose it is a matter of preference; it seems that relying on these
stored "volume serial numbers" is not a very good idea, because in
determining if paths are equal, we want to know if the devices are the
same. Rather than making a change though, a warning in the docs might
be reasonable though.
>>>> One case that doesn't work at all is directories. The error messages
>>> are:
>>
>>> error with path: d:\temp
>>> error code: 5
>>> error message: Access is denied.
>>
>>> Do you see any workaround for that?
After a more thorough reading of the Windows API documentation, I found
that it is necessary to specify FILE_FLAG_BACKUP_SEMANTICS in order to
open a directory. This fixes the problem; the only catch is that it
becomes necessary to call GetFileAttributes to determine if the path is
a directory.
I've attached a revised version, which seems to work on both file and
directory paths.
[snip]
-- Jeremy Maitin-Shepard
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk