[Python-3000] Mini Path object

Paul Moore p.f.moore at gmail.com
Sun Nov 26 20:48:55 CET 2006


On 11/26/06, Jim Jewett <jimjjewett at gmail.com> wrote:
> On 11/26/06, Mike Orr <sluggoster at gmail.com> wrote:
> > On 11/26/06, Jim Jewett <jimjjewett at gmail.com> wrote:
> > > C: without a slash is effectively a mount point into
> > >  the current directory.
>
> > That's what I always thought "C:foo" is.  But Glyph
> > said it's more complicated than that:
>
> Most of the exceptions were things like the CON special file.  These
> make the windows (or DOS) filesystem wierd, but they aren't really
> affected by C: vs C:\
>
> CON, C:\dir1\CON, C:CON, and .\con all refer to the same special file.

Technically, every drive has a "current path". You can see this by
doing the following on a Windows system (here, the prompt shows the
current path)

C:\Data>cd F:\Software

*** Note from the following prompt that this does *not* change the
current directory - because the current drive is C:, and we changed
the directory on F:

C:\Data>dir F:4nt.zip
 Volume in drive F is Data
 Volume Serial Number is 7043-3187

 Directory of F:\Software

[...]

*** But note that F:4nt.zip is located in F:\Software, which is where
we made the current directory on F:

C:\Data>f:

F:\Software>

*** And if we go to the F: drive (unspecified directory) we get to
\Software, the current directory on F:.

Basically, Windows maintains a full set of current directories, one
for each drive (actually stored as hidden environment variables named
something like "=C:", "=D:" etc.) and D:foo refers to the file foo in
the current directory on the D: drive.

This is obscure to the point where I doubt anyone relies on it, but
it's the sort of edge case that you need to get right or someone will
complain in the end... :-)

Nitpicking-ly y'rs

Paul.


More information about the Python-3000 mailing list