Port PluginObject fix downstream. See http://trac.webkit.org/changeset/61415/ for...
[chromium-blink-merge.git] / base / file_util_mac.mm
blob7f81e8aeaaf11d117df92c60317336aa7e20f5ad
1 // Copyright (c) 2006-2008 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 <Cocoa/Cocoa.h>
8 #include <copyfile.h>
10 #include "base/file_path.h"
11 #include "base/logging.h"
12 #include "base/string_util.h"
14 namespace file_util {
16 bool GetTempDir(FilePath* path) {
17   NSString* tmp = NSTemporaryDirectory();
18   if (tmp == nil)
19     return false;
20   *path = FilePath([tmp fileSystemRepresentation]);
21   return true;
24 bool GetShmemTempDir(FilePath* path) {
25   return GetTempDir(path);
28 bool CopyFile(const FilePath& from_path, const FilePath& to_path) {
29   return (copyfile(from_path.value().c_str(),
30                    to_path.value().c_str(), NULL, COPYFILE_ALL) == 0);
33 }  // namespace