From 6faa0e0d23ca6fc27ae603063ce23eb018a670cd Mon Sep 17 00:00:00 2001 From: "phajdan.jr@chromium.org" Date: Tue, 28 Apr 2009 06:50:36 +0000 Subject: ImportantFileWriter Introducing a class for writing important files, preventing their corruption during writing. Switched PrefService to use it. Other classes will be switched in future changesets. TEST=This may affect things using preferences. Make sure that changes in preferences don't get lost, and that you don't get excessive disk activity when changing preferences. http://crbug.com/10618 Review URL: http://codereview.chromium.org/83001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@14717 0039d316-1c4b-4281-b951-d872f2087c98 --- base/file_util.cc | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'base/file_util.cc') diff --git a/base/file_util.cc b/base/file_util.cc index f7a0411..8eec3ac 100644 --- a/base/file_util.cc +++ b/base/file_util.cc @@ -188,6 +188,14 @@ bool ReadFileToString(const FilePath& path, std::string* contents) { return true; } +FILE* CreateAndOpenTemporaryFile(FilePath* path) { + FilePath directory; + if (!GetTempDir(&directory)) + return false; + + return CreateAndOpenTemporaryFileInDir(directory, path); +} + bool GetFileSize(const FilePath& file_path, int64* file_size) { FileInfo info; if (!GetFileInfo(file_path, &info)) -- cgit v1.1