mirror of
https://github.com/keymanapp/keyman.git
synced 2026-08-05 00:15:32 +00:00
fix(linux): check for existing file before trying to install
Under some circumstances it's possible that the user manages to select a directory instead of a kmp file, or manually enters a non-existing file. Is used to throw an error that we caught on Sentry; the user was able to continue to use the app. This change now checks for a valid file before trying to install the kmp file. Fixes: #15572 Fixes: KEYMAN-LINUX-99
This commit is contained in:
parent
96bae4296f
commit
7941b3d4a1
1 changed files with 11 additions and 7 deletions
|
|
@ -74,14 +74,18 @@ class ViewInstalledWindowBase(Gtk.Window):
|
|||
filter_text.set_name(_("KMP files"))
|
||||
filter_text.add_pattern("*.kmp")
|
||||
dlg.add_filter(filter_text)
|
||||
response = dlg.run()
|
||||
if response != Gtk.ResponseType.OK:
|
||||
dlg.destroy()
|
||||
return
|
||||
while True:
|
||||
response = dlg.run()
|
||||
if response != Gtk.ResponseType.OK:
|
||||
dlg.destroy()
|
||||
return
|
||||
|
||||
file = dlg.get_filename()
|
||||
dlg.destroy()
|
||||
self.restart(self.install_file(file))
|
||||
file = dlg.get_filename()
|
||||
if file and os.path.isfile(file) and os.path.splitext(file)[1] == '.kmp':
|
||||
dlg.destroy()
|
||||
self.restart(self.install_file(file))
|
||||
return
|
||||
# Loop until we have a valid file or the user cancels the dialog
|
||||
|
||||
def install_file(self, kmpfile, language=None):
|
||||
installDlg = InstallKmpWindow(kmpfile, viewkmp=self, language=language)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue