aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/google/protobuf/compiler/importer.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/google/protobuf/compiler/importer.cc')
-rw-r--r--src/google/protobuf/compiler/importer.cc7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/google/protobuf/compiler/importer.cc b/src/google/protobuf/compiler/importer.cc
index 7689ce93..422f759f 100644
--- a/src/google/protobuf/compiler/importer.cc
+++ b/src/google/protobuf/compiler/importer.cc
@@ -231,7 +231,12 @@ static string CanonicalizePath(string path) {
// The Win32 API accepts forward slashes as a path delimiter even though
// backslashes are standard. Let's avoid confusion and use only forward
// slashes.
- path = StringReplace(path, "\\", "/", true);
+ if (HasPrefixString(path, "\\\\")) {
+ // Avoid converting two leading backslashes.
+ path = "\\\\" + StringReplace(path.substr(2), "\\", "/", true);
+ } else {
+ path = StringReplace(path, "\\", "/", true);
+ }
#endif
vector<string> parts;