Skip to content

Commit

Permalink
Cleaned up file storage removal code (#95)
Browse files Browse the repository at this point in the history
Co-authored-by: Brandon Sneed <[email protected]>
  • Loading branch information
bsneed and Brandon Sneed authored Nov 16, 2021
1 parent c09663c commit 7343c71
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
4 changes: 2 additions & 2 deletions Package.resolved
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
"repositoryURL": "https://github.com/segmentio/Sovran-Swift.git",
"state": {
"branch": null,
"revision": "be79aad4393d36959f422c2b40566b84ee1170f7",
"version": "1.0.2"
"revision": "944c17d7c46bd95fc37f09136cabd172be5b413b",
"version": "1.0.3"
}
}
]
Expand Down
5 changes: 1 addition & 4 deletions Sources/Segment/Utilities/Storage.swift
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,6 @@ internal class Storage: Subscriber {
syncQueue.sync {
// remove the temp file.
try? FileManager.default.removeItem(atPath: file.path)
// remove the unfinished event storage file.
let actualFile = file.deletingPathExtension()
try? FileManager.default.removeItem(atPath: actualFile.path)
}
}

Expand Down Expand Up @@ -308,7 +305,7 @@ extension Storage {

let tempFile = file.appendingPathExtension(Storage.tempExtension)
do {
try FileManager.default.copyItem(at: file, to: tempFile)
try FileManager.default.moveItem(at: file, to: tempFile)
} catch {
Analytics.segmentLog(message: "Unable to rename to temp: \(file), Error: \(error)", kind: .error)
}
Expand Down

0 comments on commit 7343c71

Please sign in to comment.