fix issue preventing profile rename/delete

qtwebengineprocess.exe inherits the current working directory, so if
it is started after the profile is loaded, it prevents the profile
media folder from being renamed/deleted

also, load profile on first run at the same point we normally load
the profile
This commit is contained in:
Damien Elmes 2019-04-09 18:48:50 +10:00
parent 8dbebe3583
commit 478ee66d0e

View file

@ -39,12 +39,6 @@ class AnkiQt(QMainWindow):
aqt.mw = self
self.app = app
self.pm = profileManager
# running 2.0 for the first time?
if self.pm.meta['firstRun']:
# load the new deck user profile
self.pm.load(self.pm.profiles()[0])
self.pm.meta['firstRun'] = False
self.pm.save()
# init rest of app
self.safeMode = self.app.queryKeyboardModifiers() & Qt.ShiftModifier
try:
@ -108,6 +102,12 @@ class AnkiQt(QMainWindow):
self.closeFires = True
def setupProfile(self):
if self.pm.meta['firstRun']:
# load the new deck user profile
self.pm.load(self.pm.profiles()[0])
self.pm.meta['firstRun'] = False
self.pm.save()
self.pendingImport = None
self.restoringBackup = False
# profile not provided on command line?
@ -607,6 +607,11 @@ title="%s" %s>%s</button>''' % (
self.mainLayout.addWidget(sweb)
self.form.centralwidget.setLayout(self.mainLayout)
# force webengine processes to load before cwd is changed
if isWin:
self.web._page.setHtml("")
self.bottomWeb._page.setHtml("")
def closeAllWindows(self, onsuccess):
aqt.dialogs.closeAll(onsuccess)