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/file_util.h" | 9 #include "base/file_util.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 } | 92 } |
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 (!((path[0] >= 'A' && path[0] <= 'Z') || | 103 if (!IsAsciiAlpha(path[0])) |
104 path[0] >= 'a' && path[0] <= 'z')) | |
105 return false; | 104 return false; |
106 | 105 |
107 if (!IsSlash(path[2])) | 106 if (!IsSlash(path[2])) |
108 return false; | 107 return false; |
109 return true; | 108 return true; |
110 } | 109 } |
111 #endif | 110 #endif |
112 | 111 |
113 // 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 |
114 // 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 637 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
752 return GetGenDirForSourceDir(target->settings(), target->label().dir()); | 751 return GetGenDirForSourceDir(target->settings(), target->label().dir()); |
753 } | 752 } |
754 | 753 |
755 SourceDir GetCurrentOutputDir(const Scope* scope) { | 754 SourceDir GetCurrentOutputDir(const Scope* scope) { |
756 return GetOutputDirForSourceDir(scope->settings(), scope->GetSourceDir()); | 755 return GetOutputDirForSourceDir(scope->settings(), scope->GetSourceDir()); |
757 } | 756 } |
758 | 757 |
759 SourceDir GetCurrentGenDir(const Scope* scope) { | 758 SourceDir GetCurrentGenDir(const Scope* scope) { |
760 return GetGenDirForSourceDir(scope->settings(), scope->GetSourceDir()); | 759 return GetGenDirForSourceDir(scope->settings(), scope->GetSourceDir()); |
761 } | 760 } |
OLD | NEW |