Updating trunk VERSION from 833.0 to 834.0
[chromium-blink-merge.git] / base / file_util_mac.mm
blob95d4f25722a9d9859ff4dd169bf23bef6a248db1
1 // Copyright (c) 2010 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>
8 #include <copyfile.h>
10 #include "base/basictypes.h"
11 #include "base/file_path.h"
12 #include "base/string_util.h"
13 #include "base/threading/thread_restrictions.h"
15 namespace file_util {
17 bool GetTempDir(FilePath* path) {
18   NSString* tmp = NSTemporaryDirectory();
19   if (tmp == nil)
20     return false;
21   *path = FilePath([tmp fileSystemRepresentation]);
22   return true;
25 bool GetShmemTempDir(FilePath* path) {
26   return GetTempDir(path);
29 bool CopyFile(const FilePath& from_path, const FilePath& to_path) {
30   base::ThreadRestrictions::AssertIOAllowed();
31   return (copyfile(from_path.value().c_str(),
32                    to_path.value().c_str(), NULL, COPYFILE_ALL) == 0);
35 }  // namespace