Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. |
michael@0 | 2 | // Use of this source code is governed by a BSD-style license that can be |
michael@0 | 3 | // found in the LICENSE file. |
michael@0 | 4 | |
michael@0 | 5 | #include "base/file_util.h" |
michael@0 | 6 | |
michael@0 | 7 | #import <Cocoa/Cocoa.h> |
michael@0 | 8 | #include <copyfile.h> |
michael@0 | 9 | |
michael@0 | 10 | #include "base/file_path.h" |
michael@0 | 11 | #include "base/logging.h" |
michael@0 | 12 | #include "base/string_util.h" |
michael@0 | 13 | #include "base/scoped_nsautorelease_pool.h" |
michael@0 | 14 | |
michael@0 | 15 | namespace file_util { |
michael@0 | 16 | |
michael@0 | 17 | bool GetTempDir(FilePath* path) { |
michael@0 | 18 | base::ScopedNSAutoreleasePool autorelease_pool; |
michael@0 | 19 | NSString* tmp = NSTemporaryDirectory(); |
michael@0 | 20 | if (tmp == nil) |
michael@0 | 21 | return false; |
michael@0 | 22 | *path = FilePath([tmp fileSystemRepresentation]); |
michael@0 | 23 | return true; |
michael@0 | 24 | } |
michael@0 | 25 | |
michael@0 | 26 | bool GetShmemTempDir(FilePath* path) { |
michael@0 | 27 | return GetTempDir(path); |
michael@0 | 28 | } |
michael@0 | 29 | |
michael@0 | 30 | bool CopyFile(const FilePath& from_path, const FilePath& to_path) { |
michael@0 | 31 | return (copyfile(from_path.value().c_str(), |
michael@0 | 32 | to_path.value().c_str(), NULL, COPYFILE_ALL) == 0); |
michael@0 | 33 | } |
michael@0 | 34 | |
michael@0 | 35 | } // namespace |