From aaaeee5bc4891da203c39272f371feb946f1cd00 Mon Sep 17 00:00:00 2001 From: Konstantin Shcheglov Date: Thu, 1 Dec 2016 08:39:44 -0800 Subject: [PATCH] Make MemoryResourceProvider.convertPath() work with partially posix paths. So that 'C:\some\path/to/file.dart' -> 'C:\some\path\to\file.dart'. R=paulberry@google.com, brianwilkerson@google.com BUG= Review URL: https://codereview.chromium.org/2542793003 . --- pkg/analyzer/lib/file_system/memory_file_system.dart | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/pkg/analyzer/lib/file_system/memory_file_system.dart b/pkg/analyzer/lib/file_system/memory_file_system.dart index 42731be1b09..20f69e7260e 100644 --- a/pkg/analyzer/lib/file_system/memory_file_system.dart +++ b/pkg/analyzer/lib/file_system/memory_file_system.dart @@ -50,10 +50,11 @@ class MemoryResourceProvider implements ResourceProvider { * this class are never converted automatically. */ String convertPath(String path) { - if (pathContext.style == pathos.windows.style && - path.startsWith(pathos.posix.separator)) { - path = r'C:' + - path.replaceAll(pathos.posix.separator, pathos.windows.separator); + if (pathContext.style == pathos.windows.style) { + if (path.startsWith(pathos.posix.separator)) { + path = r'C:' + path; + } + path = path.replaceAll(pathos.posix.separator, pathos.windows.separator); } return path; }