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

Side by Side Diff: base/file_util_mac.mm

Issue 8825: Begin the first small step towards using FilePath everywhere: (Closed)
Patch Set: works on windows Created 12 years, 1 month 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
« no previous file with comments | « base/file_util_linux.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) 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/logging.h" 11 #include "base/logging.h"
11 #include "base/string_util.h" 12 #include "base/string_util.h"
12 13
13 namespace file_util { 14 namespace file_util {
14 15
15 const wchar_t kPathSeparator = L'/'; 16 const wchar_t kPathSeparator = L'/';
16 17
17 bool GetTempDir(std::wstring* path) { 18 bool GetTempDir(FilePath* path) {
18 NSString* tmp = NSTemporaryDirectory(); 19 NSString* tmp = NSTemporaryDirectory();
19 if (tmp == nil) 20 if (tmp == nil)
20 return false; 21 return false;
21 *path = reinterpret_cast<const wchar_t*>( 22 *path = FilePath([tmp fileSystemRepresentation]);
22 [tmp cStringUsingEncoding:NSUTF32StringEncoding]);
23 return true; 23 return true;
24 } 24 }
25 25
26 bool CopyFile(const std::wstring& from_path, const std::wstring& to_path) { 26 bool CopyFile(const FilePath& from_path, const FilePath& to_path) {
27 return (copyfile(WideToUTF8(from_path).c_str(), 27 return (copyfile(from_path.value().c_str(),
28 WideToUTF8(to_path).c_str(), NULL, COPYFILE_ALL) == 0); 28 to_path.value().c_str(), NULL, COPYFILE_ALL) == 0);
29 } 29 }
30 30
31 } // namespace 31 } // namespace
OLDNEW
« no previous file with comments | « base/file_util_linux.cc ('k') | base/file_util_posix.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698