Skip to content

Commit

Permalink
Only deleteItem if file exists at path.
Browse files Browse the repository at this point in the history
Implemented here partly to ease merge with proposed changes in other pull requests.
  • Loading branch information
babbage committed Apr 9, 2018
1 parent c13d059 commit 751477b
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions FBSnapshotsViewer/Extensions/FileManager+Move.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,13 @@ import Foundation

extension FileManager {
func moveItem(at fromURL: URL, to toURL: URL) throws {
try self.removeItem(at: toURL)
try deleteItem(at: toURL)
try self.copyItem(at: fromURL, to: toURL)
}

func deleteItem(at url: URL) throws {
try self.removeItem(at: url)
if fileExists(atPath: url.path) {
try self.removeItem(at: url)
}
}
}

0 comments on commit 751477b

Please sign in to comment.