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 730 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
741 if (source_dir.is_source_absolute()) { | 741 if (source_dir.is_source_absolute()) { |
742 // The source dir is source-absolute, so we trim off the two leading | 742 // The source dir is source-absolute, so we trim off the two leading |
743 // slashes to append to the toolchain object directory. | 743 // slashes to append to the toolchain object directory. |
744 result.value().append(&source_dir.value()[2], | 744 result.value().append(&source_dir.value()[2], |
745 source_dir.value().size() - 2); | 745 source_dir.value().size() - 2); |
746 } else { | 746 } else { |
747 // system-absolute | 747 // system-absolute |
748 const std::string& build_dir = | 748 const std::string& build_dir = |
749 settings->build_settings()->build_dir().value(); | 749 settings->build_settings()->build_dir().value(); |
750 | 750 |
751 if (StartsWithASCII(source_dir.value(), build_dir, true)) { | 751 if (base::StartsWithASCII(source_dir.value(), build_dir, true)) { |
752 size_t build_dir_size = build_dir.size(); | 752 size_t build_dir_size = build_dir.size(); |
753 result.value().append(&source_dir.value()[build_dir_size], | 753 result.value().append(&source_dir.value()[build_dir_size], |
754 source_dir.value().size() - build_dir_size); | 754 source_dir.value().size() - build_dir_size); |
755 } else { | 755 } else { |
756 result.value().append("ABS_PATH"); | 756 result.value().append("ABS_PATH"); |
757 #if defined(OS_WIN) | 757 #if defined(OS_WIN) |
758 // Windows absolute path contains ':' after drive letter. Remove it to | 758 // Windows absolute path contains ':' after drive letter. Remove it to |
759 // avoid inserting ':' in the middle of path (eg. "ABS_PATH/C:/"). | 759 // avoid inserting ':' in the middle of path (eg. "ABS_PATH/C:/"). |
760 std::string src_dir_value = source_dir.value(); | 760 std::string src_dir_value = source_dir.value(); |
761 const auto colon_pos = src_dir_value.find(':'); | 761 const auto colon_pos = src_dir_value.find(':'); |
(...skipping 51 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 |