OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 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 | 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 <Cocoa/Cocoa.h> | 7 #import <Cocoa/Cocoa.h> |
8 #include <copyfile.h> | 8 #include <copyfile.h> |
9 | 9 |
10 #include "base/file_path.h" | 10 #include "base/file_path.h" |
11 #include "base/logging.h" | 11 #include "base/logging.h" |
12 #include "base/string_util.h" | 12 #include "base/string_util.h" |
13 | 13 |
14 namespace file_util { | 14 namespace file_util { |
15 | 15 |
16 const wchar_t kPathSeparator = L'/'; | |
17 | |
18 bool GetTempDir(FilePath* path) { | 16 bool GetTempDir(FilePath* path) { |
19 NSString* tmp = NSTemporaryDirectory(); | 17 NSString* tmp = NSTemporaryDirectory(); |
20 if (tmp == nil) | 18 if (tmp == nil) |
21 return false; | 19 return false; |
22 *path = FilePath([tmp fileSystemRepresentation]); | 20 *path = FilePath([tmp fileSystemRepresentation]); |
23 return true; | 21 return true; |
24 } | 22 } |
25 | 23 |
26 bool CopyFile(const FilePath& from_path, const FilePath& to_path) { | 24 bool CopyFile(const FilePath& from_path, const FilePath& to_path) { |
27 return (copyfile(from_path.value().c_str(), | 25 return (copyfile(from_path.value().c_str(), |
28 to_path.value().c_str(), NULL, COPYFILE_ALL) == 0); | 26 to_path.value().c_str(), NULL, COPYFILE_ALL) == 0); |
29 } | 27 } |
30 | 28 |
31 } // namespace | 29 } // namespace |
OLD | NEW |