diff options
author | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-11-27 23:22:08 +0000 |
---|---|---|
committer | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-11-27 23:22:08 +0000 |
commit | b264eab5d4331e19d04f5822be50c88c61b58267 (patch) | |
tree | f419df89f0e49df6cfa3f161062526d8ee648f6e /base/file_util.h | |
parent | caaa849e2e0cc9caf9a2fe938e43515c35bfa679 (diff) | |
download | chromium_src-b264eab5d4331e19d04f5822be50c88c61b58267.zip chromium_src-b264eab5d4331e19d04f5822be50c88c61b58267.tar.gz chromium_src-b264eab5d4331e19d04f5822be50c88c61b58267.tar.bz2 |
Move Posix file utils to the base namespace.
BUG=
R=rvargas@chromium.org
Review URL: https://codereview.chromium.org/89523002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@237642 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/file_util.h')
-rw-r--r-- | base/file_util.h | 29 |
1 files changed, 14 insertions, 15 deletions
diff --git a/base/file_util.h b/base/file_util.h index 2950df1..ac9f67d 100644 --- a/base/file_util.h +++ b/base/file_util.h @@ -137,13 +137,8 @@ BASE_EXPORT bool TextContentsEqual(const FilePath& filename1, // Useful for unit tests. BASE_EXPORT bool ReadFileToString(const FilePath& path, std::string* contents); -} // namespace base - -// ----------------------------------------------------------------------------- - -namespace file_util { - #if defined(OS_POSIX) + // Read exactly |bytes| bytes from file descriptor |fd|, storing the result // in |buffer|. This function is protected against EINTR and partial reads. // Returns true iff |bytes| bytes have been successfully read from |fd|. @@ -151,13 +146,12 @@ BASE_EXPORT bool ReadFromFD(int fd, char* buffer, size_t bytes); // Creates a symbolic link at |symlink| pointing to |target|. Returns // false on failure. -BASE_EXPORT bool CreateSymbolicLink(const base::FilePath& target, - const base::FilePath& symlink); +BASE_EXPORT bool CreateSymbolicLink(const FilePath& target, + const FilePath& symlink); // Reads the given |symlink| and returns where it points to in |target|. // Returns false upon failure. -BASE_EXPORT bool ReadSymbolicLink(const base::FilePath& symlink, - base::FilePath* target); +BASE_EXPORT bool ReadSymbolicLink(const FilePath& symlink, FilePath* target); // Bits ans masks of the file permission. enum FilePermissionBits { @@ -180,13 +174,18 @@ enum FilePermissionBits { // Reads the permission of the given |path|, storing the file permission // bits in |mode|. If |path| is symbolic link, |mode| is the permission of // a file which the symlink points to. -BASE_EXPORT bool GetPosixFilePermissions(const base::FilePath& path, - int* mode); +BASE_EXPORT bool GetPosixFilePermissions(const FilePath& path, int* mode); // Sets the permission of the given |path|. If |path| is symbolic link, sets // the permission of a file which the symlink points to. -BASE_EXPORT bool SetPosixFilePermissions(const base::FilePath& path, - int mode); -#endif // defined(OS_POSIX) +BASE_EXPORT bool SetPosixFilePermissions(const FilePath& path, int mode); + +#endif // OS_POSIX + +} // namespace base + +// ----------------------------------------------------------------------------- + +namespace file_util { // Return true if the given directory is empty BASE_EXPORT bool IsDirectoryEmpty(const base::FilePath& dir_path); |