michael@0: // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. michael@0: // Use of this source code is governed by a BSD-style license that can be michael@0: // found in the LICENSE file. michael@0: michael@0: #include "base/file_util.h" michael@0: michael@0: #import michael@0: #include michael@0: michael@0: #include "base/file_path.h" michael@0: #include "base/logging.h" michael@0: #include "base/string_util.h" michael@0: #include "base/scoped_nsautorelease_pool.h" michael@0: michael@0: namespace file_util { michael@0: michael@0: bool GetTempDir(FilePath* path) { michael@0: base::ScopedNSAutoreleasePool autorelease_pool; michael@0: NSString* tmp = NSTemporaryDirectory(); michael@0: if (tmp == nil) michael@0: return false; michael@0: *path = FilePath([tmp fileSystemRepresentation]); michael@0: return true; michael@0: } michael@0: michael@0: bool GetShmemTempDir(FilePath* path) { michael@0: return GetTempDir(path); michael@0: } michael@0: michael@0: bool CopyFile(const FilePath& from_path, const FilePath& to_path) { michael@0: return (copyfile(from_path.value().c_str(), michael@0: to_path.value().c_str(), NULL, COPYFILE_ALL) == 0); michael@0: } michael@0: michael@0: } // namespace