OLD | NEW |
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/filesystem_utils.h" | 5 #include "tools/gn/filesystem_utils.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/files/file_util.h" | 9 #include "base/files/file_util.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 | 93 |
94 bool DoesBeginWindowsDriveLetter(const base::StringPiece& path) { | 94 bool DoesBeginWindowsDriveLetter(const base::StringPiece& path) { |
95 if (path.size() < 3) | 95 if (path.size() < 3) |
96 return false; | 96 return false; |
97 | 97 |
98 // Check colon first, this will generally fail fastest. | 98 // Check colon first, this will generally fail fastest. |
99 if (path[1] != ':') | 99 if (path[1] != ':') |
100 return false; | 100 return false; |
101 | 101 |
102 // Check drive letter. | 102 // Check drive letter. |
103 if (!IsAsciiAlpha(path[0])) | 103 if (!base::IsAsciiAlpha(path[0])) |
104 return false; | 104 return false; |
105 | 105 |
106 if (!IsSlash(path[2])) | 106 if (!IsSlash(path[2])) |
107 return false; | 107 return false; |
108 return true; | 108 return true; |
109 } | 109 } |
110 #endif | 110 #endif |
111 | 111 |
112 // A wrapper around FilePath.GetComponents that works the way we need. This is | 112 // A wrapper around FilePath.GetComponents that works the way we need. This is |
113 // not super efficient since it does some O(n) transformations on the path. If | 113 // not super efficient since it does some O(n) transformations on the path. If |
(...skipping 699 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
813 | 813 |
814 SourceDir GetCurrentOutputDir(const Scope* scope) { | 814 SourceDir GetCurrentOutputDir(const Scope* scope) { |
815 return GetOutputDirForSourceDirAsOutputFile( | 815 return GetOutputDirForSourceDirAsOutputFile( |
816 scope->settings(), scope->GetSourceDir()).AsSourceDir( | 816 scope->settings(), scope->GetSourceDir()).AsSourceDir( |
817 scope->settings()->build_settings()); | 817 scope->settings()->build_settings()); |
818 } | 818 } |
819 | 819 |
820 SourceDir GetCurrentGenDir(const Scope* scope) { | 820 SourceDir GetCurrentGenDir(const Scope* scope) { |
821 return GetGenDirForSourceDir(scope->settings(), scope->GetSourceDir()); | 821 return GetGenDirForSourceDir(scope->settings(), scope->GetSourceDir()); |
822 } | 822 } |
OLD | NEW |