ipc/chromium/src/base/file_util_mac.mm

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/ipc/chromium/src/base/file_util_mac.mm	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,35 @@
     1.4 +// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
     1.5 +// Use of this source code is governed by a BSD-style license that can be
     1.6 +// found in the LICENSE file.
     1.7 +
     1.8 +#include "base/file_util.h"
     1.9 +
    1.10 +#import <Cocoa/Cocoa.h>
    1.11 +#include <copyfile.h>
    1.12 +
    1.13 +#include "base/file_path.h"
    1.14 +#include "base/logging.h"
    1.15 +#include "base/string_util.h"
    1.16 +#include "base/scoped_nsautorelease_pool.h"
    1.17 +
    1.18 +namespace file_util {
    1.19 +
    1.20 +bool GetTempDir(FilePath* path) {
    1.21 +  base::ScopedNSAutoreleasePool autorelease_pool;
    1.22 +  NSString* tmp = NSTemporaryDirectory();
    1.23 +  if (tmp == nil)
    1.24 +    return false;
    1.25 +  *path = FilePath([tmp fileSystemRepresentation]);
    1.26 +  return true;
    1.27 +}
    1.28 +
    1.29 +bool GetShmemTempDir(FilePath* path) {
    1.30 +  return GetTempDir(path);
    1.31 +}
    1.32 +
    1.33 +bool CopyFile(const FilePath& from_path, const FilePath& to_path) {
    1.34 +  return (copyfile(from_path.value().c_str(),
    1.35 +                   to_path.value().c_str(), NULL, COPYFILE_ALL) == 0);
    1.36 +}
    1.37 +
    1.38 +}  // namespace

mercurial