OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-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 // 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 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
276 bool GetTempDir(FilePath* path); | 276 bool GetTempDir(FilePath* path); |
277 // Deprecated temporary compatibility function. | 277 // Deprecated temporary compatibility function. |
278 bool GetTempDir(std::wstring* path); | 278 bool GetTempDir(std::wstring* path); |
279 // Get a temporary directory for shared memory files. | 279 // Get a temporary directory for shared memory files. |
280 // Only useful on POSIX; redirects to GetTempDir() on Windows. | 280 // Only useful on POSIX; redirects to GetTempDir() on Windows. |
281 bool GetShmemTempDir(FilePath* path); | 281 bool GetShmemTempDir(FilePath* path); |
282 | 282 |
283 // Creates a temporary file. The full path is placed in |path|, and the | 283 // Creates a temporary file. The full path is placed in |path|, and the |
284 // function returns true if was successful in creating the file. The file will | 284 // function returns true if was successful in creating the file. The file will |
285 // be empty and all handles closed after this function returns. | 285 // be empty and all handles closed after this function returns. |
286 // TODO(erikkay): rename this function and track down all of the callers. | 286 bool CreateTemporaryFile(FilePath* path); |
287 // (Clarification of erik's comment: the intent is to rename the BlahFileName() | |
288 // calls into BlahFile(), since they create temp files (not temp filenames).) | |
289 bool CreateTemporaryFileName(FilePath* path); | |
290 // Deprecated temporary compatibility function. | |
291 bool CreateTemporaryFileName(std::wstring* temp_file); | |
292 | 287 |
293 // Create and open a temporary file. File is opened for read/write. | 288 // Create and open a temporary file. File is opened for read/write. |
294 // The full path is placed in |path|, and the function returns true if | 289 // The full path is placed in |path|, and the function returns true if |
295 // was successful in creating and opening the file. | 290 // was successful in creating and opening the file. |
296 FILE* CreateAndOpenTemporaryFile(FilePath* path); | 291 FILE* CreateAndOpenTemporaryFile(FilePath* path); |
297 // Like above but for shmem files. Only useful for POSIX. | 292 // Like above but for shmem files. Only useful for POSIX. |
298 FILE* CreateAndOpenTemporaryShmemFile(FilePath* path); | 293 FILE* CreateAndOpenTemporaryShmemFile(FilePath* path); |
299 | 294 |
300 // Similar to CreateAndOpenTemporaryFile, but the file is created in |dir|. | 295 // Similar to CreateAndOpenTemporaryFile, but the file is created in |dir|. |
301 FILE* CreateAndOpenTemporaryFileInDir(const FilePath& dir, FilePath* path); | 296 FILE* CreateAndOpenTemporaryFileInDir(const FilePath& dir, FilePath* path); |
302 | 297 |
303 // Same as CreateTemporaryFileName but the file is created in |dir|. | 298 // Same as CreateTemporaryFile but the file is created in |dir|. |
304 bool CreateTemporaryFileNameInDir(const std::wstring& dir, | 299 bool CreateTemporaryFileInDir(const FilePath& dir, |
305 std::wstring* temp_file); | 300 FilePath* temp_file); |
306 | 301 |
307 // Create a new directory under TempPath. If prefix is provided, the new | 302 // Create a new directory under TempPath. If prefix is provided, the new |
308 // directory name is in the format of prefixyyyy. | 303 // directory name is in the format of prefixyyyy. |
309 // NOTE: prefix is ignored in the POSIX implementation. | 304 // NOTE: prefix is ignored in the POSIX implementation. |
310 // TODO(erikkay): is this OK? | 305 // TODO(erikkay): is this OK? |
311 // If success, return true and output the full path of the directory created. | 306 // If success, return true and output the full path of the directory created. |
312 bool CreateNewTempDirectory(const FilePath::StringType& prefix, | 307 bool CreateNewTempDirectory(const FilePath::StringType& prefix, |
313 FilePath* new_temp_path); | 308 FilePath* new_temp_path); |
314 // Deprecated temporary compatibility function. | 309 // Deprecated temporary compatibility function. |
315 bool CreateNewTempDirectory(const std::wstring& prefix, | 310 bool CreateNewTempDirectory(const std::wstring& prefix, |
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
550 | 545 |
551 // Renames a file using the SHFileOperation API to ensure that the target file | 546 // Renames a file using the SHFileOperation API to ensure that the target file |
552 // gets the correct default security descriptor in the new path. | 547 // gets the correct default security descriptor in the new path. |
553 bool RenameFileAndResetSecurityDescriptor( | 548 bool RenameFileAndResetSecurityDescriptor( |
554 const FilePath& source_file_path, | 549 const FilePath& source_file_path, |
555 const FilePath& target_file_path); | 550 const FilePath& target_file_path); |
556 | 551 |
557 } // namespace file_util | 552 } // namespace file_util |
558 | 553 |
559 #endif // BASE_FILE_UTIL_H_ | 554 #endif // BASE_FILE_UTIL_H_ |
OLD | NEW |