Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(751)

Side by Side Diff: base/file_util_mac.mm

Issue 18332014: Move Copy* into the base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: windows Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « base/file_util.cc ('k') | base/file_util_posix.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/file_util.h" 5 #include "base/file_util.h"
6 6
7 #import <Foundation/Foundation.h> 7 #import <Foundation/Foundation.h>
8 #include <copyfile.h> 8 #include <copyfile.h>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
11 #include "base/files/file_path.h" 11 #include "base/files/file_path.h"
12 #include "base/mac/foundation_util.h" 12 #include "base/mac/foundation_util.h"
13 #include "base/strings/string_util.h" 13 #include "base/strings/string_util.h"
14 #include "base/threading/thread_restrictions.h" 14 #include "base/threading/thread_restrictions.h"
15 15
16 namespace base {
17 namespace internal {
18
19 bool CopyFileUnsafe(const FilePath& from_path, const FilePath& to_path) {
20 ThreadRestrictions::AssertIOAllowed();
21 return (copyfile(from_path.value().c_str(),
22 to_path.value().c_str(), NULL, COPYFILE_ALL) == 0);
23 }
24
25 } // namespace internal
26 } // namepsace base
27
16 namespace file_util { 28 namespace file_util {
17 29
18 bool GetTempDir(base::FilePath* path) { 30 bool GetTempDir(base::FilePath* path) {
19 NSString* tmp = NSTemporaryDirectory(); 31 NSString* tmp = NSTemporaryDirectory();
20 if (tmp == nil) 32 if (tmp == nil)
21 return false; 33 return false;
22 *path = base::mac::NSStringToFilePath(tmp); 34 *path = base::mac::NSStringToFilePath(tmp);
23 return true; 35 return true;
24 } 36 }
25 37
26 bool GetShmemTempDir(base::FilePath* path, bool executable) { 38 bool GetShmemTempDir(base::FilePath* path, bool executable) {
27 return GetTempDir(path); 39 return GetTempDir(path);
28 } 40 }
29 41
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);
35 }
36
37 } // namespace 42 } // namespace
OLDNEW
« no previous file with comments | « base/file_util.cc ('k') | base/file_util_posix.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698