[TransWarp] ZConfig and MS-like file paths

alexander smishlajev alex at ank-sia.com
Tue Jul 15 10:46:32 EDT 2003

Phillip J. Eby wrote, at 15.07.2003 16:38:

> By the way, the "technically correct" way to specify such a URL is:
> file:///e|/src/Test/App/app_config.xml

the whole matter about 'file:' urls on non-posix platforms is rather 
complicated.  i would like to quote from Fourthought, Inc. folks who did 
quite a research on the topic:

=== cut ===
# see the following XML-SIG threads for 'file:' URI resolution discussion
#> http://aspn.activestate.com/ASPN/Mail/Message/xml-sig/614905
#> http://aspn.activestate.com/ASPN/Mail/Message/xml-sig/614913
#> http://mail.python.org/pipermail/xml-sig/2001-February/004572.html
# also see how Perl handles them:
#  http://www.perldoc.com/perl5.8.0/lib/URI/file.html
# These are valid absoluteURIs:
#  file:/autoexec.bat     (scheme ":" abs_path)
#  file:///autoexec.bat   (scheme ":" net_path)
# This one is valid but is not what you'd expect it to be:
#  file://autoexec.bat    (authority = autoexec.bat, no abs_path)
# If you have any more than 3 slashes, it's OK because each path segment
# can be an empty string.
# This one is valid too, although everything after 'file:' is
# considered an opaque_part:
#   file:etc/passwd
# Unescaped backslashes are NOT allowed in URIs, ever.
# It is not possible to use them as path segment separators.
# Yet... Windows Explorer will accept these:
#   file:C:\WINNT\setuplog.txt
#   file:/C:\WINNT\setuplog.txt
#   file:///C:\WINNT\setuplog.txt
# However, it will also accept "|" in place of the colon after the drive:
#   file:C|/WINNT/setuplog.txt
#   file:/C|/WINNT/setuplog.txt
#   file:///C|/WINNT/setuplog.txt
# RFC 1738 says file://localhost/ and file:/// are equivalent;
# localhost in this case is always the local machine, no matter what
# your DNS says.
# Basically, any file: URI is valid. Good luck resolving them, though.
=== cut ===

(it seems to me that pipermail archives on python.org were rebuilt 
since, and the url in this qoute point to an irrelevant message.  i 
guess that url should be 

> which is hideous, but will work with or without the fix.  Unfortunately, 
> to use it on the command line, you may have to escape the '|', leading to:
> file:///e\|/src/Test/App/app_config.xml
> Only I'm not sure whether you *can* escape the | symbol from a Windows 
> command prompt. Sigh.

on the command line, you need to include the whole argument in double 
quotes.  try:

   echo "file:///e|/src/Test/App/app_config.xml"

to step aside from the discussion on what is and what is not a valid 
file url, may it be possible to use 'supportedSchemes' to construct the 
re pattern for FileURL.fromFilename, and not use generic URLMatch?  i 
mean, anything that is passed to fromFilename() and does not start with 
'file:' scheme should be a local file path.  (otherwise why was it 
passed to fromFilename?)

best wishes,

More information about the PEAK mailing list