| OLD | NEW |
| 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/base_paths_mac.h" | 5 #include "base/base_paths_mac.h" |
| 6 | 6 |
| 7 #include <dlfcn.h> | 7 #include <dlfcn.h> |
| 8 #import <Foundation/Foundation.h> | 8 #import <Foundation/Foundation.h> |
| 9 #include <mach-o/dyld.h> | 9 #include <mach-o/dyld.h> |
| 10 | 10 |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 bool PathProviderMac(int key, FilePath* result) { | 52 bool PathProviderMac(int key, FilePath* result) { |
| 53 switch (key) { | 53 switch (key) { |
| 54 case base::FILE_EXE: | 54 case base::FILE_EXE: |
| 55 GetNSExecutablePath(result); | 55 GetNSExecutablePath(result); |
| 56 return true; | 56 return true; |
| 57 case base::FILE_MODULE: | 57 case base::FILE_MODULE: |
| 58 return GetModulePathForAddress(result, | 58 return GetModulePathForAddress(result, |
| 59 reinterpret_cast<const void*>(&base::PathProviderMac)); | 59 reinterpret_cast<const void*>(&base::PathProviderMac)); |
| 60 case base::DIR_CACHE: | 60 case base::DIR_CACHE: |
| 61 return base::mac::GetUserDirectory(NSCachesDirectory, result); | 61 return base::mac::GetUserDirectory(NSCachesDirectory, result); |
| 62 case base::DIR_DESKTOP: |
| 63 return base::mac::GetUserDirectory(NSDesktopDirectory, result); |
| 64 case base::DIR_DOCUMENTS: |
| 65 return base::mac::GetUserDirectory(NSDocumentDirectory, result); |
| 66 case base::DIR_DOWNLOADS: |
| 67 return base::mac::GetUserDirectory(NSDownloadsDirectory, result); |
| 62 case base::DIR_APP_DATA: { | 68 case base::DIR_APP_DATA: { |
| 63 bool success = base::mac::GetUserDirectory(NSApplicationSupportDirectory, | 69 bool success = base::mac::GetUserDirectory(NSApplicationSupportDirectory, |
| 64 result); | 70 result); |
| 65 #if defined(OS_IOS) | 71 #if defined(OS_IOS) |
| 66 // On IOS, this directory does not exist unless it is created explicitly. | 72 // On IOS, this directory does not exist unless it is created explicitly. |
| 67 if (success && !file_util::PathExists(*result)) | 73 if (success && !file_util::PathExists(*result)) |
| 68 success = file_util::CreateDirectory(*result); | 74 success = file_util::CreateDirectory(*result); |
| 69 #endif // defined(OS_IOS) | 75 #endif // defined(OS_IOS) |
| 70 return success; | 76 return success; |
| 71 } | 77 } |
| (...skipping 22 matching lines...) Expand all Loading... |
| 94 case base::DIR_HOME: { | 100 case base::DIR_HOME: { |
| 95 *result = base::mac::NSStringToFilePath(NSHomeDirectory()); | 101 *result = base::mac::NSStringToFilePath(NSHomeDirectory()); |
| 96 return true; | 102 return true; |
| 97 } | 103 } |
| 98 default: | 104 default: |
| 99 return false; | 105 return false; |
| 100 } | 106 } |
| 101 } | 107 } |
| 102 | 108 |
| 103 } // namespace base | 109 } // namespace base |
| OLD | NEW |