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

Side by Side Diff: base/file_util.h

Issue 654009: Deprecate GetDirectoryFromPath on non-Windows. (Closed)
Patch Set: with comment Created 10 years, 10 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 | « no previous file | base/file_util_deprecated.h » ('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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 // This file contains utility functions for dealing with the local 5 // This file contains utility functions for dealing with the local
6 // filesystem. 6 // filesystem.
7 7
8 #ifndef BASE_FILE_UTIL_H_ 8 #ifndef BASE_FILE_UTIL_H_
9 #define BASE_FILE_UTIL_H_ 9 #define BASE_FILE_UTIL_H_
10 10
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 //----------------------------------------------------------------------------- 42 //-----------------------------------------------------------------------------
43 // Functions that operate purely on a path string w/o touching the filesystem: 43 // Functions that operate purely on a path string w/o touching the filesystem:
44 44
45 // Returns true if the given path ends with a path separator character. 45 // Returns true if the given path ends with a path separator character.
46 bool EndsWithSeparator(const FilePath& path); 46 bool EndsWithSeparator(const FilePath& path);
47 47
48 // Makes sure that |path| ends with a separator IFF path is a directory that 48 // Makes sure that |path| ends with a separator IFF path is a directory that
49 // exists. Returns true if |path| is an existing directory, false otherwise. 49 // exists. Returns true if |path| is an existing directory, false otherwise.
50 bool EnsureEndsWithSeparator(FilePath* path); 50 bool EnsureEndsWithSeparator(FilePath* path);
51 51
52 // Returns the directory component of a path, without the trailing
53 // path separator, or an empty string on error. The function does not
54 // check for the existence of the path, so if it is passed a directory
55 // without the trailing \, it will interpret the last component of the
56 // path as a file and chomp it. This does not support relative paths.
57 // Examples:
58 // path == "C:\pics\jojo.jpg", returns "C:\pics"
59 // path == "C:\Windows\system32\", returns "C:\Windows\system32"
60 // path == "C:\Windows\system32", returns "C:\Windows"
61 std::wstring GetDirectoryFromPath(const std::wstring& path);
62
63 // Appends new_ending to path, adding a separator between the two if necessary. 52 // Appends new_ending to path, adding a separator between the two if necessary.
64 void AppendToPath(std::wstring* path, const std::wstring& new_ending); 53 void AppendToPath(std::wstring* path, const std::wstring& new_ending);
65 54
66 // Convert provided relative path into an absolute path. Returns false on 55 // Convert provided relative path into an absolute path. Returns false on
67 // error. On POSIX, this function fails if the path does not exist. 56 // error. On POSIX, this function fails if the path does not exist.
68 bool AbsolutePath(FilePath* path); 57 bool AbsolutePath(FilePath* path);
69 58
70 // Returns true if |parent| contains |child|. Both paths are converted to 59 // Returns true if |parent| contains |child|. Both paths are converted to
71 // absolute paths before doing the comparison. 60 // absolute paths before doing the comparison.
72 bool ContainsPath(const FilePath& parent, const FilePath& child); 61 bool ContainsPath(const FilePath& parent, const FilePath& child);
(...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after
509 bool HasFileBeenModifiedSince(const FileEnumerator::FindInfo& find_info, 498 bool HasFileBeenModifiedSince(const FileEnumerator::FindInfo& find_info,
510 const base::Time& cutoff_time); 499 const base::Time& cutoff_time);
511 500
512 } // namespace file_util 501 } // namespace file_util
513 502
514 // Deprecated functions have been moved to this separate header file, 503 // Deprecated functions have been moved to this separate header file,
515 // which must be included last after all the above definitions. 504 // which must be included last after all the above definitions.
516 #include "base/file_util_deprecated.h" 505 #include "base/file_util_deprecated.h"
517 506
518 #endif // BASE_FILE_UTIL_H_ 507 #endif // BASE_FILE_UTIL_H_
OLDNEW
« no previous file with comments | « no previous file | base/file_util_deprecated.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698