Log the freshness of the Variations seed in a histogram.
[chromium-blink-merge.git] / base / file_util_mac.mm
blob377654de1d2faef3a9f7fa38c55e015d17e20014
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>
8 #include <copyfile.h>
10 #include "base/basictypes.h"
11 #include "base/files/file_path.h"
12 #include "base/mac/foundation_util.h"
13 #include "base/string_util.h"
14 #include "base/threading/thread_restrictions.h"
16 namespace file_util {
18 bool GetTempDir(base::FilePath* path) {
19   NSString* tmp = NSTemporaryDirectory();
20   if (tmp == nil)
21     return false;
22   *path = base::mac::NSStringToFilePath(tmp);
23   return true;
26 bool GetShmemTempDir(base::FilePath* path, bool executable) {
27   return GetTempDir(path);
30 bool CopyFileUnsafe(const base::FilePath& from_path,
31                     const base::FilePath& to_path) {
32   base::ThreadRestrictions::AssertIOAllowed();
33   return (copyfile(from_path.value().c_str(),
34                    to_path.value().c_str(), NULL, COPYFILE_ALL) == 0);
37 }  // namespace