diff options
author | darin@google.com <darin@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-09-26 01:04:08 +0000 |
---|---|---|
committer | darin@google.com <darin@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-09-26 01:04:08 +0000 |
commit | f5e3da4d564980a048f375cf1a824a01df03382a (patch) | |
tree | 68a0562ee30146d65071d722744503d47255dec4 /base/file_util_posix.cc | |
parent | ec9207d3a86ed6ccbefc56d95034897f48f52674 (diff) | |
download | chromium_src-f5e3da4d564980a048f375cf1a824a01df03382a.zip chromium_src-f5e3da4d564980a048f375cf1a824a01df03382a.tar.gz chromium_src-f5e3da4d564980a048f375cf1a824a01df03382a.tar.bz2 |
Add file_util::GetFileInfo as a means to provide more information about a file
path. This CL changes GetFileSize to be implemented in terms of GetFileInfo
since under the hood on all platforms the same system call is used.
R=mark
Review URL: http://codereview.chromium.org/4286
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@2624 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/file_util_posix.cc')
-rw-r--r-- | base/file_util_posix.cc | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/base/file_util_posix.cc b/base/file_util_posix.cc index 4f1b1ba..65dbfcb 100644 --- a/base/file_util_posix.cc +++ b/base/file_util_posix.cc @@ -300,11 +300,12 @@ bool CreateDirectory(const std::wstring& full_path) { return true; } -bool GetFileSize(const std::wstring& file_path, int64* file_size) { +bool GetFileInfo(const std::wstring& file_path, FileInfo* results) { struct stat64 file_info; if (stat64(WideToUTF8(file_path).c_str(), &file_info) != 0) return false; - *file_size = file_info.st_size; + results->is_directory = S_ISDIR(file_info.st_mode); + results->size = file_info.st_size; return true; } |