From 751477b5aa0653d49d7e399dd10daf5632bc4024 Mon Sep 17 00:00:00 2001 From: Duncan Babbage Date: Sat, 7 Apr 2018 21:21:53 +1200 Subject: [PATCH] Only deleteItem if file exists at path. Implemented here partly to ease merge with proposed changes in other pull requests. --- FBSnapshotsViewer/Extensions/FileManager+Move.swift | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/FBSnapshotsViewer/Extensions/FileManager+Move.swift b/FBSnapshotsViewer/Extensions/FileManager+Move.swift index 3a29620..1a98128 100644 --- a/FBSnapshotsViewer/Extensions/FileManager+Move.swift +++ b/FBSnapshotsViewer/Extensions/FileManager+Move.swift @@ -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) + } } }