-
Notifications
You must be signed in to change notification settings - Fork 37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add attribute for fileprotection #971
Conversation
@@ -126,6 +126,7 @@ class FileSystemNamedCollection: NamedCollectionProcessing { | |||
let adobeBaseUrl = baseUrl.appendingPathComponent(adobeDirectory, isDirectory: true) | |||
do { | |||
try fileManager.createDirectory(at: adobeBaseUrl, withIntermediateDirectories: true) | |||
try fileManager.setAttributes([FileAttributeKey.protectionKey: FileProtectionType.none], ofItemAtPath: adobeBaseUrl.path) | |||
} catch { | |||
Log.error(label: adobeDirectory, "Failed to create storage directory with error: \(error)") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we consider adjusting this error message? Is it possible to check the reason and avoid printing this message when the error is a result of the directory already existing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It doesn't error when the directory exists. It simply doesn't do anything when the directory exists.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Codecov Report
@@ Coverage Diff @@
## migrateOffUserDefaults #971 +/- ##
==========================================================
+ Coverage 90.08% 90.11% +0.03%
==========================================================
Files 133 133
Lines 8279 8280 +1
==========================================================
+ Hits 7458 7461 +3
+ Misses 821 819 -2 |
Adds an attribute for our FileSystem storage directory and sets the fileprotection to none. This is to avoid system restrictions during app backgrounding and other potential edge cases.
Also adds capabilities to our test app for testing backgrounding tasks.