Hello!

> The original email you sent did not include any attachment. Can you
> please reply to this email with the test case attached.

 Ops, sorry. I forgot to attach the file. Here it is.

Kind regards,
Pavel Fedin
Expert Engineer
Samsung Electronics Research center Russia

import os
import sys

# Cygwin's os.path.normcase pretends it's on a case-sensitive filesystem.
_is_cygwin = sys.platform == "cygwin"
if os.path.normcase("TeSt") == os.path.normpath("TeSt") and not _is_cygwin:
    def _my_normcase(x):
        return x
else:
    def _my_normcase(x):
        return x.upper()

class Entry:
    def entry_exists_on_disk(self, name):
        try:
            d = self.on_disk_entries
        except AttributeError:
            d = {}
            try:
                entries = os.listdir(self.abspath)
            except OSError:
                pass
            else:
                for entry in map(_my_normcase, entries):
                    d[entry] = True
            self.on_disk_entries = d
        if sys.platform == 'win32':
            name = _my_normcase(name)
            result = d.get(name)
            if result is None:
                # Belt-and-suspenders for Windows:  check directly for
                # 8.3 file names that don't show up in os.listdir().
                result = os.path.exists(self.abspath + OS_SEP + name)
                d[name] = result
            return result
        else:
            return name in d

test_entry = Entry()
test_entry.abspath = '.'
result = test_entry.entry_exists_on_disk('test.py')
if result:
    print 'PASS'
else:
    print 'FAIL'

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

Reply via email to