Skip to content
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

Merged
merged 1 commit into from
Oct 16, 2023

Conversation

cdhoffmann
Copy link
Contributor

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.

@@ -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)")
Copy link
Contributor

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?

Copy link
Contributor Author

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@codecov
Copy link

codecov bot commented Oct 16, 2023

Codecov Report

Merging #971 (f8ede5f) into migrateOffUserDefaults (135f157) will increase coverage by 0.03%.
Report is 21 commits behind head on migrateOffUserDefaults.
The diff coverage is 100.00%.

@@                    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     

@cdhoffmann cdhoffmann merged commit d3a5fe1 into adobe:migrateOffUserDefaults Oct 16, 2023
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants