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

Side by Side Diff: base/file_path.h

Issue 334028: From FilePath::AppendAndResolveRelative() to file_util::AbsolutePath(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 11 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | base/file_path.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) 2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2008 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 // FilePath is a container for pathnames stored in a platform's native string 5 // FilePath is a container for pathnames stored in a platform's native string
6 // type, providing containers for manipulation in according with the 6 // type, providing containers for manipulation in according with the
7 // platform's conventions for pathnames. It supports the following path 7 // platform's conventions for pathnames. It supports the following path
8 // types: 8 // types:
9 // 9 //
10 // POSIX Windows 10 // POSIX Windows
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 bool empty() const { return path_.empty(); } 171 bool empty() const { return path_.empty(); }
172 172
173 // Returns true if |character| is in kSeparators. 173 // Returns true if |character| is in kSeparators.
174 static bool IsSeparator(CharType character); 174 static bool IsSeparator(CharType character);
175 175
176 // Returns a vector of all of the components of the provided path. It is 176 // Returns a vector of all of the components of the provided path. It is
177 // equivalent to calling DirName().value() on the path's root component, 177 // equivalent to calling DirName().value() on the path's root component,
178 // and BaseName().value() on each child component. 178 // and BaseName().value() on each child component.
179 void GetComponents(std::vector<FilePath::StringType>* components) const; 179 void GetComponents(std::vector<FilePath::StringType>* components) const;
180 180
181 // Returns true, and sets *path to resulting full path, if relative_path can
182 // be applied to current path by resolving any '..' it may contain. Returns
183 // false otherwise, e.g., if relative path is absolute, or if it climbs back
184 // up the hierarchy too far (i.e., beyond the root of current path).
185 //
186 // Note that if the current path ends with a file name, we won't try to
187 // figure it out (so this method doesn't go to the disk) and we will blindly
188 // append relative_path at the end of the current path, including the file
189 // name in the current path (if any).
190 bool AppendAndResolveRelative(const FilePath& relative_path,
191 FilePath* path) const;
192
193 // Returns true if this FilePath is a strict parent of the |child|. Absolute 181 // Returns true if this FilePath is a strict parent of the |child|. Absolute
194 // and relative paths are accepted i.e. is /foo parent to /foo/bar and 182 // and relative paths are accepted i.e. is /foo parent to /foo/bar and
195 // is foo parent to foo/bar. Does not convert paths to absolute, follow 183 // is foo parent to foo/bar. Does not convert paths to absolute, follow
196 // symlinks or directory navigation (e.g. ".."). A path is *NOT* its own 184 // symlinks or directory navigation (e.g. ".."). A path is *NOT* its own
197 // parent. 185 // parent.
198 bool IsParent(const FilePath& child) const; 186 bool IsParent(const FilePath& child) const;
199 187
200 // If IsParent(child) holds, appends to path (if non-NULL) the 188 // If IsParent(child) holds, appends to path (if non-NULL) the
201 // relative path to child and returns true. For example, if parent 189 // relative path to child and returns true. For example, if parent
202 // holds "/Users/johndoe/Library/Application Support", child holds 190 // holds "/Users/johndoe/Library/Application Support", child holds
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
336 namespace stdext { 324 namespace stdext {
337 325
338 inline size_t hash_value(const FilePath& f) { 326 inline size_t hash_value(const FilePath& f) {
339 return hash_value(f.value()); 327 return hash_value(f.value());
340 } 328 }
341 329
342 } // namespace stdext 330 } // namespace stdext
343 #endif // COMPILER 331 #endif // COMPILER
344 332
345 #endif // BASE_FILE_PATH_H_ 333 #endif // BASE_FILE_PATH_H_
OLDNEW
« no previous file with comments | « no previous file | base/file_path.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698