mirror of
https://github.com/lutris/lutris
synced 2024-09-15 22:09:55 +00:00
Double migration!
Do migration early if any command line options are present, but do it in the init dialog if that is shown. This may result in migration being run twice, but the second time does nothing. The advantage is that in normal startup (non CLI) scenarios, migration (whcih can take some time) runs while the init dialog is up Resolves #4646
This commit is contained in:
parent
cf95fe7d99
commit
1fd2ff7292
|
@ -369,7 +369,7 @@ class Application(Gtk.Application):
|
|||
options = command_line.get_options_dict()
|
||||
|
||||
# Use stdout to output logs, only if no command line argument is
|
||||
# provided
|
||||
# provided.
|
||||
argc = len(sys.argv) - 1
|
||||
if "-d" in sys.argv or "--debug" in sys.argv:
|
||||
argc -= 1
|
||||
|
@ -401,7 +401,17 @@ class Application(Gtk.Application):
|
|||
return 0
|
||||
|
||||
init_lutris()
|
||||
migrate()
|
||||
|
||||
# Perform migrations early if any command line options
|
||||
# might require it to be done, just in case. We migrate
|
||||
# also during the init dialog, but it should be harmless
|
||||
# to do it twice.
|
||||
#
|
||||
# This way, in typical lutris usage, you get to see the
|
||||
# init dialog when migration is happening.
|
||||
if argc:
|
||||
migrate()
|
||||
|
||||
run_all_checks()
|
||||
|
||||
if options.contains("dest"):
|
||||
|
|
|
@ -10,6 +10,7 @@ from gi.repository import Gdk, GLib, GObject, Gtk
|
|||
|
||||
from lutris import api, settings
|
||||
from lutris.gui.widgets.log_text_view import LogTextView
|
||||
from lutris.migrations import migrate
|
||||
from lutris.util import datapath
|
||||
from lutris.util.jobs import AsyncCall
|
||||
from lutris.util.log import logger
|
||||
|
@ -244,12 +245,16 @@ class LutrisInitDialog(Gtk.Dialog):
|
|||
|
||||
self.connect("response", self.on_response)
|
||||
self.connect("destroy", self.on_destroy)
|
||||
AsyncCall(runtime_updater.update_runtimes, self.init_cb)
|
||||
AsyncCall(self.run_init, self.init_cb)
|
||||
|
||||
def show_progress(self):
|
||||
self.progress.pulse()
|
||||
return True
|
||||
|
||||
def run_init(self):
|
||||
migrate()
|
||||
self.runtime_updater.update_runtimes()
|
||||
|
||||
def init_cb(self, _result, error):
|
||||
if error:
|
||||
ErrorDialog(str(error), parent=self)
|
||||
|
|
Loading…
Reference in a new issue