move parseArgs to the top of aqt.run()
By placing argument parsing at the top, we skip starting up all the QT stuff when using options like --help or --version that cause the program to exit anyway.
This commit is contained in:
parent
4dc60e4f1e
commit
370fd6507d
@ -174,6 +174,11 @@ def run():
|
||||
global mw
|
||||
from anki.utils import isMac
|
||||
|
||||
# parse args
|
||||
opts, args = parseArgs(sys.argv)
|
||||
opts.base = unicode(opts.base or "", sys.getfilesystemencoding())
|
||||
opts.profile = unicode(opts.profile or "", sys.getfilesystemencoding())
|
||||
|
||||
# on osx we'll need to add the qt plugins to the search path
|
||||
if isMac and getattr(sys, 'frozen', None):
|
||||
rd = os.path.abspath(moduleDir + "/../../..")
|
||||
@ -203,11 +208,6 @@ environment points to a valid, writable folder.""")
|
||||
"upgrade to a newer Qt, you may experience issues such as images "
|
||||
"failing to show up during review.")
|
||||
|
||||
# parse args
|
||||
opts, args = parseArgs(sys.argv)
|
||||
opts.base = unicode(opts.base or "", sys.getfilesystemencoding())
|
||||
opts.profile = unicode(opts.profile or "", sys.getfilesystemencoding())
|
||||
|
||||
# profile manager
|
||||
from aqt.profiles import ProfileManager
|
||||
pm = ProfileManager(opts.base, opts.profile)
|
||||
|
Loading…
Reference in New Issue
Block a user