Message1406

Author pekka.klarck
Recipients
Date 2007-02-17.01:17:07
SpamBayes Score
Marked as misclassified
Message-id
In-reply-to
Content
Following only slightly hackish implementation seems to fix this issue at least based on manual tests on Windows. I'll submit this as a part of a patch for os.path.abspath bug http://jython.org/bugs/1661700 unless separate patches are somehow better. Before that I anyway need to get some automated tests done first. 


_CASE_INSENSITIVE = None

def _case_insensitive_system():
    global _CASE_INSENSITIVE
    if _CASE_INSENSITIVE is None:
        path = abspath(os.curdir)
        _CASE_INSENSITIVE = samefile(path.lower(), path.upper())
    return _CASE_INSENSITIVE

def _tostr(s, method):
    if isinstance(s, basestring):
        return s
    import org
    raise TypeError, "%s() argument must be a str or unicode object, not %s" % (
                method, org.python.core.Py.safeRepr(s))
    
def _tofile(s, method):
    return File(_tostr(s, method))

def normcase(path):
    path = _tofile(path, "normcase").getPath() 
    if _case_insensitive_system():
        path = path.lower()
    return path
History
Date User Action Args
2008-02-20 17:17:40adminlinkissue1648449 messages
2008-02-20 17:17:40admincreate