1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "ios/chrome/browser/file_metadata_util.h"
7 #import <Foundation/Foundation.h>
9 #include "base/logging.h"
10 #include "base/strings/sys_string_conversions.h"
11 #include "base/threading/thread_restrictions.h"
13 namespace file_metadata_util {
15 void AddSkipSystemBackupAttributeToItem(const base::FilePath& path) {
16 base::ThreadRestrictions::AssertIOAllowed();
19 [NSURL fileURLWithPath:base::SysUTF8ToNSString(path.value())];
20 DCHECK([[NSFileManager defaultManager] fileExistsAtPath:file_url.path]);
23 BOOL success = [file_url setResourceValue:@YES
24 forKey:NSURLIsExcludedFromBackupKey
27 LOG(ERROR) << [[error description] UTF8String];
31 } // namespace file_metadata_util