Brendan Oakley | 5 Mar 2007 19:30
Picon

Re: UNC path names

The behavior might depends on the program. On Windows different shells
behave differently. In Windows XP's cmd.exe:

Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

C:\Documents and Settings\HP_Owner>cd \\eeyore\brendan
'\\eeyore\brendan'
CMD does not support UNC paths as current directories.

In 4NT:

4NT  3.01A   Windows NT 5.00
Copyright 1988-1998  Rex Conn & JP Software Inc.  All Rights Reserved

[c:\documents and settings\brendan]cd \\c0web100\d\

[c:\documents and settings\brendan]

See CMD blames itself for the limitation. 4NT does not give an error
message at all, but whether it has actually done anything I can't
tell. Maybe it's like 'cd' on a drive other than the current one, but
how to refer to that drive I don't know.

IIRC on libc ash and bash, the 'cd' command changes the current drive
as well as the current directory, unlike OS/2's cmd which only changes
the current directory on the referenced drive, leaving the current
drive alone.

My point is that whether this behavior of chdir() is a bug or not
(Continue reading)

Brendan Oakley | 5 Mar 2007 19:37
Picon

Re: UNC path names

Just remembered how to change to a UNC path in 4NT. Thereafter 'cd'
does work. For what it's worth.

4NT  3.01A   Windows NT 5.00
Copyright 1988-1998  Rex Conn & JP Software Inc.  All Rights Reserved

[c:\documents and settings\brendan]\\c0web100\d\

[\\c0web100\d]
[\\c0web100\d]cd \\c0web100\d\btmp

[\\c0web100\d\btmp]

Brendan
Brendan Oakley | 5 Mar 2007 20:05
Picon

Re: UNC path names

This is from the Visual Basic documentation on MSDN. I found no
information in Visual C. I interpret this to mean the current behavior
of libc, as described, matches the documented behavior on Windows. But
again, there may be reason to define it differently.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbcn7/html/vbconIntroductionToFileSystemObjectModel.asp

App.Path, ChDir, ChDrive, and CurDir

If you use the Path property (App.Path), the ChDrive and ChDir
statements, or the CurDir function, be aware that they may return a
Universal Naming Convention (UNC) path (that is, one beginning with
\\Server\Share...) rather than a drive path (such as e:\Folder),
depending on how you run your program or project.

App.Path returns a UNC path when:

    * You run a project after loading it from a network share, even if
the network share is mapped to a drive letter.
    * You run a compiled executable file from a network share (but
only if it is run using a UNC path).

ChDrive cannot handle UNC paths, and it raises an error when App.Path
returns one. You can handle this error by adding On Error Resume Next
before the ChDrive statement, or by testing the first two characters
of App.Path to see if they are backslashes.

The command prompt always has a drive path for the current directory,
so CurDir is set to a drive path. ChDir does not raise an error, but
it fails to change the directory from a drive path to a UNC path. The
(Continue reading)


Gmane