From 3c650a1cf01844ffed5b0828562b45f664e0d695 Mon Sep 17 00:00:00 2001 From: jahorton Date: Wed, 18 Dec 2019 08:33:15 +0700 Subject: [PATCH 1/2] fix(ios): Fixes #2455, allows adhoc overwrite/file-replacement --- ios/keyman/Keyman/Keyman/AppDelegate.swift | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/ios/keyman/Keyman/Keyman/AppDelegate.swift b/ios/keyman/Keyman/Keyman/AppDelegate.swift index 4d7162426d..34076ee254 100644 --- a/ios/keyman/Keyman/Keyman/AppDelegate.swift +++ b/ios/keyman/Keyman/Keyman/AppDelegate.swift @@ -26,11 +26,21 @@ class AppDelegate: UIResponder, UIApplicationDelegate { var destinationUrl = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask)[0] destinationUrl.appendPathComponent("\(url.lastPathComponent).zip") do { - try FileManager.default.copyItem(at: url, to: destinationUrl) + let fileManager = FileManager.default + + // For now, we'll always allow overwriting. + if fileManager.fileExists(atPath: destinationUrl.path) { + try fileManager.removeItem(at: destinationUrl) + } + + // Throws an error if the destination file already exists, and there's no + // built-in override parameter. Hence, the previous if-block. + try fileManager.copyItem(at: url, to: destinationUrl) installAdhocKeyboard(url: destinationUrl) return true } catch { showKMPError(KMPError.copyFiles) + log.error(error) return false } } From bd64b0a74ac31f8ac277e9247600e63ea45bf760 Mon Sep 17 00:00:00 2001 From: jahorton Date: Wed, 18 Dec 2019 11:43:48 +0700 Subject: [PATCH 2/2] docs(ios): history.md for kmp overwrite PR --- ios/history.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ios/history.md b/ios/history.md index a6190f0819..95135d65f5 100644 --- a/ios/history.md +++ b/ios/history.md @@ -3,6 +3,9 @@ ## 13.0 alpha * Start version 13.0 +## 2019-12-19 12.0.63 stable +* Fixed issue with reinstalling or updating previously installed language resources from local files (#2461) + ## 2019-12-05 12.0.62 stable * Fix situation where lexical models would not install (#2420)