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 648 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
659 | 659 |
660 for (size_t i = initial_path_comp_to_use; i < path_comp.size(); i++) { | 660 for (size_t i = initial_path_comp_to_use; i < path_comp.size(); i++) { |
661 result_str.append(FilePathToUTF8(path_comp[i])); | 661 result_str.append(FilePathToUTF8(path_comp[i])); |
662 result_str.push_back('/'); | 662 result_str.push_back('/'); |
663 } | 663 } |
664 return SourceDir(result_str); | 664 return SourceDir(result_str); |
665 } | 665 } |
666 | 666 |
667 SourceDir SourceDirForCurrentDirectory(const base::FilePath& source_root) { | 667 SourceDir SourceDirForCurrentDirectory(const base::FilePath& source_root) { |
668 base::FilePath cd; | 668 base::FilePath cd; |
669 file_util::GetCurrentDirectory(&cd); | 669 base::GetCurrentDirectory(&cd); |
670 return SourceDirForPath(source_root, cd); | 670 return SourceDirForPath(source_root, cd); |
671 } | 671 } |
672 | 672 |
673 SourceDir GetToolchainOutputDir(const Settings* settings) { | 673 SourceDir GetToolchainOutputDir(const Settings* settings) { |
674 const OutputFile& toolchain_subdir = settings->toolchain_output_subdir(); | 674 const OutputFile& toolchain_subdir = settings->toolchain_output_subdir(); |
675 | 675 |
676 std::string result = settings->build_settings()->build_dir().value(); | 676 std::string result = settings->build_settings()->build_dir().value(); |
677 if (!toolchain_subdir.value().empty()) | 677 if (!toolchain_subdir.value().empty()) |
678 result.append(toolchain_subdir.value()); | 678 result.append(toolchain_subdir.value()); |
679 | 679 |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
730 return GetGenDirForSourceDir(target->settings(), target->label().dir()); | 730 return GetGenDirForSourceDir(target->settings(), target->label().dir()); |
731 } | 731 } |
732 | 732 |
733 SourceDir GetCurrentOutputDir(const Scope* scope) { | 733 SourceDir GetCurrentOutputDir(const Scope* scope) { |
734 return GetOutputDirForSourceDir(scope->settings(), scope->GetSourceDir()); | 734 return GetOutputDirForSourceDir(scope->settings(), scope->GetSourceDir()); |
735 } | 735 } |
736 | 736 |
737 SourceDir GetCurrentGenDir(const Scope* scope) { | 737 SourceDir GetCurrentGenDir(const Scope* scope) { |
738 return GetGenDirForSourceDir(scope->settings(), scope->GetSourceDir()); | 738 return GetGenDirForSourceDir(scope->settings(), scope->GetSourceDir()); |
739 } | 739 } |
OLD | NEW |