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

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

Issue 26561005: GYP generator for GN (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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 | Annotate | Revision Log
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 28 matching lines...) Expand all
39 DCHECK(value_.find('/') != std::string::npos); 39 DCHECK(value_.find('/') != std::string::npos);
40 size_t last_slash = value_.rfind('/'); 40 size_t last_slash = value_.rfind('/');
41 return SourceDir(base::StringPiece(&value_[0], last_slash + 1)); 41 return SourceDir(base::StringPiece(&value_[0], last_slash + 1));
42 } 42 }
43 43
44 base::FilePath SourceFile::Resolve(const base::FilePath& source_root) const { 44 base::FilePath SourceFile::Resolve(const base::FilePath& source_root) const {
45 if (is_null()) 45 if (is_null())
46 return base::FilePath(); 46 return base::FilePath();
47 47
48 std::string converted; 48 std::string converted;
49 #if defined(OS_WIN)
50 if (is_system_absolute()) { 49 if (is_system_absolute()) {
51 converted.assign(&value_[1], value_.size() - 1); 50 if (value_.size() > 2 && value_[2] == ':') {
52 DCHECK(converted.size() > 2 && converted[1] == ':') 51 // Windows path, strip the leading slash.
53 << "Expecting Windows absolute file path with a drive letter: " 52 converted.assign(&value_[1], value_.size() - 1);
54 << value_; 53 } else {
54 converted.assign(value_);
55 }
56 ConvertPathToSystem(&converted);
55 return base::FilePath(UTF8ToFilePath(converted)); 57 return base::FilePath(UTF8ToFilePath(converted));
56 } 58 }
57 59
58 converted.assign(&value_[2], value_.size() - 2); 60 converted.assign(&value_[2], value_.size() - 2);
59 ConvertPathToSystem(&converted); 61 ConvertPathToSystem(&converted);
60 return source_root.Append(UTF8ToFilePath(converted)); 62 return source_root.Append(UTF8ToFilePath(converted));
61 #else
62 if (is_system_absolute())
63 return base::FilePath(value_);
64 converted.assign(&value_[2], value_.size() - 2);
65 return source_root.Append(converted);
66 #endif
67 } 63 }
OLDNEW
« tools/gn/source_dir.cc ('K') | « tools/gn/source_dir.cc ('k') | tools/gn/target.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698