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 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 // Don't use IsSeparator since we always want to allow backslashes. | 125 // Don't use IsSeparator since we always want to allow backslashes. |
126 if (result[0] == FILE_PATH_LITERAL("/") || | 126 if (result[0] == FILE_PATH_LITERAL("/") || |
127 result[0] == FILE_PATH_LITERAL("\\")) | 127 result[0] == FILE_PATH_LITERAL("\\")) |
128 result.erase(result.begin()); | 128 result.erase(result.begin()); |
129 | 129 |
130 #if defined(OS_WIN) | 130 #if defined(OS_WIN) |
131 // On Windows, GetComponents will give us [ "C:", "/", "foo" ], and we | 131 // On Windows, GetComponents will give us [ "C:", "/", "foo" ], and we |
132 // don't want the slash in there. This doesn't support input like "C:foo" | 132 // don't want the slash in there. This doesn't support input like "C:foo" |
133 // which means foo relative to the current directory of the C drive but | 133 // which means foo relative to the current directory of the C drive but |
134 // that's basically legacy DOS behavior we don't need to support. | 134 // that's basically legacy DOS behavior we don't need to support. |
135 if (result.size() >= 2 && result[1].size() == 1 && IsSlash(result[1][0])) | 135 if (result.size() >= 2 && result[1].size() == 1 && |
| 136 IsSlash(static_cast<char>(result[1][0]))) |
136 result.erase(result.begin() + 1); | 137 result.erase(result.begin() + 1); |
137 #endif | 138 #endif |
138 | 139 |
139 return result; | 140 return result; |
140 } | 141 } |
141 | 142 |
142 // Provides the equivalent of == for filesystem strings, trying to do | 143 // Provides the equivalent of == for filesystem strings, trying to do |
143 // approximately the right thing with case. | 144 // approximately the right thing with case. |
144 bool FilesystemStringsEqual(const base::FilePath::StringType& a, | 145 bool FilesystemStringsEqual(const base::FilePath::StringType& a, |
145 const base::FilePath::StringType& b) { | 146 const base::FilePath::StringType& b) { |
(...skipping 598 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
744 | 745 |
745 SourceDir GetCurrentOutputDir(const Scope* scope) { | 746 SourceDir GetCurrentOutputDir(const Scope* scope) { |
746 return GetOutputDirForSourceDirAsOutputFile( | 747 return GetOutputDirForSourceDirAsOutputFile( |
747 scope->settings(), scope->GetSourceDir()).AsSourceDir( | 748 scope->settings(), scope->GetSourceDir()).AsSourceDir( |
748 scope->settings()->build_settings()); | 749 scope->settings()->build_settings()); |
749 } | 750 } |
750 | 751 |
751 SourceDir GetCurrentGenDir(const Scope* scope) { | 752 SourceDir GetCurrentGenDir(const Scope* scope) { |
752 return GetGenDirForSourceDir(scope->settings(), scope->GetSourceDir()); | 753 return GetGenDirForSourceDir(scope->settings(), scope->GetSourceDir()); |
753 } | 754 } |
OLD | NEW |