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

Side by Side Diff: tools/gn/source_file.cc

Issue 613083003: gn format: support absolute file system paths (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: help Created 6 years, 2 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "tools/gn/source_file.h" 5 #include "tools/gn/source_file.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "build/build_config.h" 8 #include "build/build_config.h"
9 #include "tools/gn/filesystem_utils.h" 9 #include "tools/gn/filesystem_utils.h"
10 #include "tools/gn/source_dir.h" 10 #include "tools/gn/source_dir.h"
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 if (value_.size() > 2 && value_[2] == ':') { 57 if (value_.size() > 2 && value_[2] == ':') {
58 // Windows path, strip the leading slash. 58 // Windows path, strip the leading slash.
59 converted.assign(&value_[1], value_.size() - 1); 59 converted.assign(&value_[1], value_.size() - 1);
60 } else { 60 } else {
61 converted.assign(value_); 61 converted.assign(value_);
62 } 62 }
63 return base::FilePath(UTF8ToFilePath(converted)); 63 return base::FilePath(UTF8ToFilePath(converted));
64 } 64 }
65 65
66 converted.assign(&value_[2], value_.size() - 2); 66 converted.assign(&value_[2], value_.size() - 2);
67 if (source_root.empty())
68 return UTF8ToFilePath(converted).NormalizePathSeparatorsTo('/');
67 return source_root.Append(UTF8ToFilePath(converted)) 69 return source_root.Append(UTF8ToFilePath(converted))
68 .NormalizePathSeparatorsTo('/'); 70 .NormalizePathSeparatorsTo('/');
69 } 71 }
OLDNEW
« tools/gn/command_format.cc ('K') | « tools/gn/command_format_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698