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/logging.h" | 9 #include "base/logging.h" |
10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 break; | 190 break; |
191 | 191 |
192 default: | 192 default: |
193 NOTREACHED(); | 193 NOTREACHED(); |
194 } | 194 } |
195 return ""; | 195 return ""; |
196 } | 196 } |
197 | 197 |
198 std::string FilePathToUTF8(const base::FilePath::StringType& str) { | 198 std::string FilePathToUTF8(const base::FilePath::StringType& str) { |
199 #if defined(OS_WIN) | 199 #if defined(OS_WIN) |
200 return WideToUTF8(str); | 200 return base::WideToUTF8(str); |
201 #else | 201 #else |
202 return str; | 202 return str; |
203 #endif | 203 #endif |
204 } | 204 } |
205 | 205 |
206 base::FilePath UTF8ToFilePath(const base::StringPiece& sp) { | 206 base::FilePath UTF8ToFilePath(const base::StringPiece& sp) { |
207 #if defined(OS_WIN) | 207 #if defined(OS_WIN) |
208 return base::FilePath(UTF8ToWide(sp)); | 208 return base::FilePath(base::UTF8ToWide(sp)); |
209 #else | 209 #else |
210 return base::FilePath(sp.as_string()); | 210 return base::FilePath(sp.as_string()); |
211 #endif | 211 #endif |
212 } | 212 } |
213 | 213 |
214 size_t FindExtensionOffset(const std::string& path) { | 214 size_t FindExtensionOffset(const std::string& path) { |
215 for (int i = static_cast<int>(path.size()); i >= 0; i--) { | 215 for (int i = static_cast<int>(path.size()); i >= 0; i--) { |
216 if (path[i] == '/') | 216 if (path[i] == '/') |
217 break; | 217 break; |
218 if (path[i] == '.') | 218 if (path[i] == '.') |
(...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
624 return GetGenDirForSourceDir(target->settings(), target->label().dir()); | 624 return GetGenDirForSourceDir(target->settings(), target->label().dir()); |
625 } | 625 } |
626 | 626 |
627 SourceDir GetCurrentOutputDir(const Scope* scope) { | 627 SourceDir GetCurrentOutputDir(const Scope* scope) { |
628 return GetOutputDirForSourceDir(scope->settings(), scope->GetSourceDir()); | 628 return GetOutputDirForSourceDir(scope->settings(), scope->GetSourceDir()); |
629 } | 629 } |
630 | 630 |
631 SourceDir GetCurrentGenDir(const Scope* scope) { | 631 SourceDir GetCurrentGenDir(const Scope* scope) { |
632 return GetGenDirForSourceDir(scope->settings(), scope->GetSourceDir()); | 632 return GetGenDirForSourceDir(scope->settings(), scope->GetSourceDir()); |
633 } | 633 } |
OLD | NEW |