| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #include "base/file_util.h" | 5 #include "base/file_util.h" |
| 6 | 6 |
| 7 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
| 8 #include <io.h> | 8 #include <io.h> |
| 9 #endif | 9 #endif |
| 10 #include <stdio.h> | 10 #include <stdio.h> |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 } | 178 } |
| 179 | 179 |
| 180 FILE* CreateAndOpenTemporaryFile(FilePath* path) { | 180 FILE* CreateAndOpenTemporaryFile(FilePath* path) { |
| 181 FilePath directory; | 181 FilePath directory; |
| 182 if (!GetTempDir(&directory)) | 182 if (!GetTempDir(&directory)) |
| 183 return NULL; | 183 return NULL; |
| 184 | 184 |
| 185 return CreateAndOpenTemporaryFileInDir(directory, path); | 185 return CreateAndOpenTemporaryFileInDir(directory, path); |
| 186 } | 186 } |
| 187 | 187 |
| 188 bool CreateDirectory(const base::FilePath& full_path) { |
| 189 return CreateDirectoryAndGetError(full_path, NULL); |
| 190 } |
| 191 |
| 188 bool GetFileSize(const FilePath& file_path, int64* file_size) { | 192 bool GetFileSize(const FilePath& file_path, int64* file_size) { |
| 189 base::PlatformFileInfo info; | 193 base::PlatformFileInfo info; |
| 190 if (!GetFileInfo(file_path, &info)) | 194 if (!GetFileInfo(file_path, &info)) |
| 191 return false; | 195 return false; |
| 192 *file_size = info.size; | 196 *file_size = info.size; |
| 193 return true; | 197 return true; |
| 194 } | 198 } |
| 195 | 199 |
| 196 bool TouchFile(const FilePath& path, | 200 bool TouchFile(const FilePath& path, |
| 197 const base::Time& last_accessed, | 201 const base::Time& last_accessed, |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 268 | 272 |
| 269 int64 ComputeDirectorySize(const FilePath& root_path) { | 273 int64 ComputeDirectorySize(const FilePath& root_path) { |
| 270 int64 running_size = 0; | 274 int64 running_size = 0; |
| 271 FileEnumerator file_iter(root_path, true, FileEnumerator::FILES); | 275 FileEnumerator file_iter(root_path, true, FileEnumerator::FILES); |
| 272 while (!file_iter.Next().empty()) | 276 while (!file_iter.Next().empty()) |
| 273 running_size += file_iter.GetInfo().GetSize(); | 277 running_size += file_iter.GetInfo().GetSize(); |
| 274 return running_size; | 278 return running_size; |
| 275 } | 279 } |
| 276 | 280 |
| 277 } // namespace | 281 } // namespace |
| OLD | NEW |