OLD | NEW |
---|---|
1 // Copyright (c) 2008-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2008-2009 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/mac_util.h" | 5 #include "base/mac_util.h" |
6 | 6 |
7 #import <Cocoa/Cocoa.h> | 7 #import <Cocoa/Cocoa.h> |
8 | 8 |
9 #include "base/file_path.h" | 9 #include "base/file_path.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
230 !it->compare(it->length() - kExtLength, kExtLength, kExt, kExtLength)) | 230 !it->compare(it->length() - kExtLength, kExtLength, kExt, kExtLength)) |
231 return FilePath(bundle_name); | 231 return FilePath(bundle_name); |
232 | 232 |
233 // Separate this component from the next one. | 233 // Separate this component from the next one. |
234 bundle_name += '/'; | 234 bundle_name += '/'; |
235 } | 235 } |
236 | 236 |
237 return FilePath(); | 237 return FilePath(); |
238 } | 238 } |
239 | 239 |
240 bool SetFileBackupExclusion(const FilePath& file_path, bool exclude) { | |
241 NSString* filePath = | |
TVL
2009/11/11 02:51:02
CHECK/DCHECK for file_path.IsAbsolute()?
| |
242 [NSString stringWithUTF8String:file_path.value().c_str()]; | |
243 NSURL* url = [NSURL fileURLWithPath:filePath]; | |
244 // Note that we always set CSBackupSetItemExcluded's excludeByPath param | |
245 // to true. This prevents a problem with toggling the setting: if the file | |
246 // is excluded with excludeByPath set to true then excludeByPath must | |
247 // also be true when un-excluding the file, otherwise the un-excluding | |
248 // will be ignored. | |
249 bool success = | |
250 CSBackupSetItemExcluded((CFURLRef)url, exclude, true) == noErr; | |
TVL
2009/11/11 02:51:02
drive by: don't the docs talk about needing to run
| |
251 if (!success) | |
252 LOG(WARNING) << "Failed to set backup excluson for file '" | |
253 << file_path.value().c_str() << "'. Continuing."; | |
254 return success; | |
255 } | |
256 | |
257 | |
240 } // namespace mac_util | 258 } // namespace mac_util |
OLD | NEW |