Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(39)

Unified Diff: tools/gn/label.cc

Issue 1742303002: Accept absolute Windows paths without leading slash in GN commands (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Format files with 'git cl format' to make presubmit script happy Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tools/gn/label_pattern.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/gn/label.cc
diff --git a/tools/gn/label.cc b/tools/gn/label.cc
index 94c0e718d4b27fc0bd3af81e557f554e362f5ba1..4545525c2ee52a1dc0addbfc438ae159a223a74e 100644
--- a/tools/gn/label.cc
+++ b/tools/gn/label.cc
@@ -99,16 +99,13 @@ bool Resolve(const SourceDir& current_dir,
size_t offset = 0;
#if defined(OS_WIN)
if (IsPathAbsolute(input)) {
- if (input[0] != '/') {
- *err = Err(original_value, "Bad absolute path.",
- "Absolute paths must be of the form /C:\\ but this is \"" +
- input.as_string() + "\".");
- return false;
- }
- if (input.size() > 3 && input[2] == ':' && IsSlash(input[3]) &&
- base::IsAsciiAlpha(input[1])) {
+ size_t drive_letter_pos = input[0] == '/' ? 1 : 0;
+ if (input.size() > drive_letter_pos + 2 &&
+ input[drive_letter_pos + 1] == ':' &&
+ IsSlash(input[drive_letter_pos + 2]) &&
+ base::IsAsciiAlpha(input[drive_letter_pos])) {
// Skip over the drive letter colon.
- offset = 3;
+ offset = drive_letter_pos + 2;
}
}
#endif
« no previous file with comments | « no previous file | tools/gn/label_pattern.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698