diff options
-rwxr-xr-x | tools/isolate/trace_inputs.py | 6 | ||||
-rwxr-xr-x | tools/isolate/trace_inputs_test.py | 16 |
2 files changed, 16 insertions, 6 deletions
diff --git a/tools/isolate/trace_inputs.py b/tools/isolate/trace_inputs.py index ca36e02..894afd6 100755 --- a/tools/isolate/trace_inputs.py +++ b/tools/isolate/trace_inputs.py @@ -208,8 +208,10 @@ if sys.platform == 'win32': # Go figure why GetShortPathName() is needed. path = GetLongPathName(GetShortPathName(path)) if path.startswith('\\\\?\\'): - return path[4:] - return path + path = path[4:] + # Always upper case the first letter since GetLongPathName() will return the + # drive letter in the case it was given. + return path[0].upper() + path[1:] def CommandLineToArgvW(command_line): diff --git a/tools/isolate/trace_inputs_test.py b/tools/isolate/trace_inputs_test.py index 89c33b4..4639aba 100755 --- a/tools/isolate/trace_inputs_test.py +++ b/tools/isolate/trace_inputs_test.py @@ -14,6 +14,11 @@ ROOT_DIR = os.path.dirname(FILE_NAME) import trace_inputs +def join_norm(*args): + """Joins and normalizes path in a single step.""" + return unicode(os.path.normpath(os.path.join(*args))) + + class TraceInputs(unittest.TestCase): def test_process_quoted_arguments(self): test_cases = ( @@ -39,10 +44,13 @@ class TraceInputs(unittest.TestCase): self.assertEquals(os.path.join('/usr', '$FOO/bar'), actual.full_path) self.assertEquals(True, actual.tainted) - -def join_norm(*args): - """Joins and normalizes path in a single step.""" - return unicode(os.path.normpath(os.path.join(*args))) + def test_native_case_windows(self): + if sys.platform != 'win32': + return + windows_path = os.environ['SystemRoot'] + self.assertEquals( + trace_inputs.get_native_path_case(windows_path.lower()), + trace_inputs.get_native_path_case(windows_path.upper())) if sys.platform != 'win32': |