Removes files if unzip is not successful
This commit is contained in:
parent
afd952fbc2
commit
eb8f27b457
|
@ -230,9 +230,14 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate {
|
||||||
private func unzipFile(at location: URL) throws -> URL {
|
private func unzipFile(at location: URL) throws -> URL {
|
||||||
var unzippedDir = location.deletingLastPathComponent()
|
var unzippedDir = location.deletingLastPathComponent()
|
||||||
unzippedDir.appendPathComponent("newtheme.nnwtheme")
|
unzippedDir.appendPathComponent("newtheme.nnwtheme")
|
||||||
try Zip.unzipFile(location, destination: unzippedDir, overwrite: true, password: nil, progress: nil, fileOutputHandler: nil)
|
do {
|
||||||
try FileManager.default.removeItem(at: location)
|
try Zip.unzipFile(location, destination: unzippedDir, overwrite: true, password: nil, progress: nil, fileOutputHandler: nil)
|
||||||
return unzippedDir
|
try FileManager.default.removeItem(at: location)
|
||||||
|
return unzippedDir
|
||||||
|
} catch {
|
||||||
|
try? FileManager.default.removeItem(at: location)
|
||||||
|
throw error
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private func renameFileToThemeName(at location: URL) throws -> URL {
|
private func renameFileToThemeName(at location: URL) throws -> URL {
|
||||||
|
|
Loading…
Reference in New Issue