Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(234)

Side by Side Diff: tools/gn/filesystem_utils.h

Issue 1126193005: Check for inputs not generated by deps (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@data
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « tools/gn/command_refs.cc ('k') | tools/gn/filesystem_utils.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #ifndef TOOLS_GN_FILESYSTEM_UTILS_H_ 5 #ifndef TOOLS_GN_FILESYSTEM_UTILS_H_
6 #define TOOLS_GN_FILESYSTEM_UTILS_H_ 6 #define TOOLS_GN_FILESYSTEM_UTILS_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 75
76 // Returns a string piece pointing into the input string identifying the 76 // Returns a string piece pointing into the input string identifying the
77 // directory name of the given path, including the last slash. Note that the 77 // directory name of the given path, including the last slash. Note that the
78 // input pointer must outlive the output. 78 // input pointer must outlive the output.
79 base::StringPiece FindDir(const std::string* path); 79 base::StringPiece FindDir(const std::string* path);
80 80
81 // Returns the substring identifying the last component of the dir, or the 81 // Returns the substring identifying the last component of the dir, or the
82 // empty substring if none. For example "//foo/bar/" -> "bar". 82 // empty substring if none. For example "//foo/bar/" -> "bar".
83 base::StringPiece FindLastDirComponent(const SourceDir& dir); 83 base::StringPiece FindLastDirComponent(const SourceDir& dir);
84 84
85 // Returns true if the given string is in the given output dir. This is pretty
86 // stupid and doesn't handle "." and "..", etc., it is designed for a sanity
87 // check to keep people from writing output files to the source directory
88 // accidentally.
89 bool IsStringInOutputDir(const SourceDir& output_dir, const std::string& str);
90
85 // Verifies that the given string references a file inside of the given 91 // Verifies that the given string references a file inside of the given
86 // directory. This is pretty stupid and doesn't handle "." and "..", etc., 92 // directory. This just uses IsStringInOutputDir above.
87 // it is designed for a sanity check to keep people from writing output files
88 // to the source directory accidentally.
89 // 93 //
90 // The origin will be blamed in the error. 94 // The origin will be blamed in the error.
91 // 95 //
92 // If the file isn't in the dir, returns false and sets the error. Otherwise 96 // If the file isn't in the dir, returns false and sets the error. Otherwise
93 // returns true and leaves the error untouched. 97 // returns true and leaves the error untouched.
94 bool EnsureStringIsInOutputDir(const SourceDir& dir, 98 bool EnsureStringIsInOutputDir(const SourceDir& output_dir,
95 const std::string& str, 99 const std::string& str,
96 const ParseNode* origin, 100 const ParseNode* origin,
97 Err* err); 101 Err* err);
98 102
99 // ---------------------------------------------------------------------------- 103 // ----------------------------------------------------------------------------
100 104
101 // Returns true if the input string is absolute. Double-slashes at the 105 // Returns true if the input string is absolute. Double-slashes at the
102 // beginning are treated as source-relative paths. On Windows, this handles 106 // beginning are treated as source-relative paths. On Windows, this handles
103 // paths of both the native format: "C:/foo" and ours "/C:/foo" 107 // paths of both the native format: "C:/foo" and ours "/C:/foo"
104 bool IsPathAbsolute(const base::StringPiece& path); 108 bool IsPathAbsolute(const base::StringPiece& path);
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 188
185 SourceDir GetTargetOutputDir(const Target* target); 189 SourceDir GetTargetOutputDir(const Target* target);
186 OutputFile GetTargetOutputDirAsOutputFile(const Target* target); 190 OutputFile GetTargetOutputDirAsOutputFile(const Target* target);
187 SourceDir GetTargetGenDir(const Target* target); 191 SourceDir GetTargetGenDir(const Target* target);
188 OutputFile GetTargetGenDirAsOutputFile(const Target* target); 192 OutputFile GetTargetGenDirAsOutputFile(const Target* target);
189 193
190 SourceDir GetCurrentOutputDir(const Scope* scope); 194 SourceDir GetCurrentOutputDir(const Scope* scope);
191 SourceDir GetCurrentGenDir(const Scope* scope); 195 SourceDir GetCurrentGenDir(const Scope* scope);
192 196
193 #endif // TOOLS_GN_FILESYSTEM_UTILS_H_ 197 #endif // TOOLS_GN_FILESYSTEM_UTILS_H_
OLDNEW
« no previous file with comments | « tools/gn/command_refs.cc ('k') | tools/gn/filesystem_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698