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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 } | 76 } |
77 | 77 |
78 // Attempts to do a case and slash-insensitive comparison of two 8-bit Windows | 78 // Attempts to do a case and slash-insensitive comparison of two 8-bit Windows |
79 // paths. | 79 // paths. |
80 bool AreAbsoluteWindowsPathsEqual(const base::StringPiece& a, | 80 bool AreAbsoluteWindowsPathsEqual(const base::StringPiece& a, |
81 const base::StringPiece& b) { | 81 const base::StringPiece& b) { |
82 if (a.size() != b.size()) | 82 if (a.size() != b.size()) |
83 return false; | 83 return false; |
84 | 84 |
85 // For now, just do a case-insensitive ASCII comparison. We could convert to | 85 // For now, just do a case-insensitive ASCII comparison. We could convert to |
86 // UTF-16 and use ICU if necessary. Or maybe base::strcasecmp is good enough? | 86 // UTF-16 and use ICU if necessary. |
87 for (size_t i = 0; i < a.size(); i++) { | 87 for (size_t i = 0; i < a.size(); i++) { |
88 if (NormalizeWindowsPathChar(a[i]) != NormalizeWindowsPathChar(b[i])) | 88 if (NormalizeWindowsPathChar(a[i]) != NormalizeWindowsPathChar(b[i])) |
89 return false; | 89 return false; |
90 } | 90 } |
91 return true; | 91 return true; |
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; |
(...skipping 716 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 |