]> granicus.if.org Git - python/commitdiff
Backport r65900: fixed get_file_system in test_os.py ('path' is unicode on py3k and...
authorHirokazu Yamamoto <ocean-city@m2.ccsnet.ne.jp>
Wed, 20 Aug 2008 04:20:53 +0000 (04:20 +0000)
committerHirokazu Yamamoto <ocean-city@m2.ccsnet.ne.jp>
Wed, 20 Aug 2008 04:20:53 +0000 (04:20 +0000)
Lib/test/test_os.py

index 89f564d4f5ce5c73540eb5519d55a4df0faead37..a4417b016a2ec840c906f4eccf23d684d54b5bdc 100644 (file)
@@ -265,12 +265,15 @@ class StatAttributeTests(unittest.TestCase):
     # systems support centiseconds
     if sys.platform == 'win32':
         def get_file_system(path):
-            import os
-            root = os.path.splitdrive(os.path.realpath("."))[0] + '\\'
+            root = os.path.splitdrive(os.path.abspath(path))[0] + '\\'
             import ctypes
-            kernel32 = ctypes.windll.kernel32
-            buf = ctypes.create_string_buffer("", 100)
-            if kernel32.GetVolumeInformationA(root, None, 0, None, None, None, buf, len(buf)):
+            from ctypes.wintypes import LPCWSTR, LPWSTR, DWORD
+            LPDWORD = ctypes.POINTER(DWORD)
+            f = ctypes.windll.kernel32.GetVolumeInformationW
+            f.argtypes = (LPCWSTR, LPWSTR, DWORD,
+                LPDWORD, LPDWORD, LPDWORD, LPWSTR, DWORD)
+            buf = ctypes.create_unicode_buffer("", 100)
+            if f(root, None, 0, None, None, None, buf, len(buf)):
                 return buf.value
 
         if get_file_system(test_support.TESTFN) == "NTFS":