On 9/24/2010 3:10 PM, Greg Ewing wrote:
Paul Moore wrote:

I dug into this once, and as far as I could tell, it's possible to get
the information on Windows, but there's no way on Linux to "ask the
filesystem".

Maybe we could use a heuristic such as:

1) Search the directory for an exact match to the name given,
return it if found.

2) Look for a match ignoring case. If one is found, test it to
see if it refers to the same file as the given path, and if so
return it.

3) Otherwise, raise an exception.


Hmm. There is no need for the function on a case sensitive file system, because the name had better be spelled with matching case: that is, if it is spelled with non-matching case it is an attempt to reference a non-existent file (or at least a different file).

So the API could do the "right thing" for case preserving or case ignoring file systems, but for case sensitive file systems, at most an existence check would be warranted.

In other words, the API, should it be created, should be "What is the actual name of the file that matches this if it exists in the filesystem", so the first check is to see if it exists in the file system (this may raise an exception if it doesn't exist), and then if it does, then on those filesystems for which it might be different, obtain the different name.
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to