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
3 // found in the LICENSE file.
5 #include "base/file_util.h"
7 #import <Foundation/Foundation.h>
10 #include "base/basictypes.h"
11 #include "base/file_path.h"
12 #include "base/mac/foundation_util.h"
13 #include "base/string_util.h"
14 #include "base/threading/thread_restrictions.h"
18 bool GetTempDir(FilePath* path) {
19 NSString* tmp = NSTemporaryDirectory();
22 *path = base::mac::NSStringToFilePath(tmp);
26 bool GetShmemTempDir(FilePath* path, bool executable) {
27 return GetTempDir(path);
30 bool CopyFileUnsafe(const FilePath& from_path, const FilePath& to_path) {
31 base::ThreadRestrictions::AssertIOAllowed();
32 return (copyfile(from_path.value().c_str(),
33 to_path.value().c_str(), NULL, COPYFILE_ALL) == 0);