Skip to content

Feature/Avoid deleting stored files when URL path is empty#6

Merged
khaptonstall merged 2 commits intomainfrom
feature/avoid-empty-file-paths
Nov 19, 2021
Merged

Feature/Avoid deleting stored files when URL path is empty#6
khaptonstall merged 2 commits intomainfrom
feature/avoid-empty-file-paths

Conversation

@khaptonstall
Copy link
Contributor

Description
Ensures the storeURLPath is not an empty string before attempting to delete items, which avoid unnecessary thrown errors.

@khaptonstall khaptonstall requested a review from a team as a code owner November 19, 2021 17:36
@rhogan11 rhogan11 self-assigned this Nov 19, 2021
rhogan11
rhogan11 previously approved these changes Nov 19, 2021
/// Deletes the store's .sqlite, .sqlite-shm, and .sqlite-wal files.
func deleteStoreFiles() throws {
guard let storeURLPath = self.url?.path else {
guard let storeURLPath = self.url?.path, !storeURLPath.isEmpty else {
Copy link

@rhogan11 rhogan11 Nov 19, 2021

Choose a reason for hiding this comment

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

wonder if there is any benefit to using file exists apis?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good call, I'll look at adjusting these checks!

@github-actions
Copy link

3 Messages
📖 Formatted with SwiftFormat v0.48.18.
📖 Linted with SwiftLint v0.41.0.
📖 👋 👋 Great job!

Generated by 🚫 Danger

@khaptonstall khaptonstall merged commit 949c805 into main Nov 19, 2021
@khaptonstall khaptonstall deleted the feature/avoid-empty-file-paths branch November 19, 2021 20:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants