Skip to content

Commit 8c3361d

Browse files
committed
Abort update if the updater is found under the root path
1 parent 97ba7aa commit 8c3361d

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

update_gui.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,11 @@ def __init__(self, server, parent=None):
6262
self.step_unit = None
6363
self.progress = 0
6464

65+
if getattr(sys, 'frozen', False):
66+
self.app_path = os.path.abspath(sys.executable)
67+
else:
68+
self.app_path = os.path.abspath(__file__)
69+
6570
self.root_path = QLineEdit()
6671
self.root_path.textChanged[str].connect(self.on_path_changed)
6772
self.browse_button = QPushButton('Browse...')
@@ -178,6 +183,9 @@ def on_update_button(self):
178183
if not os.path.isdir(root_path):
179184
QMessageBox.critical(self, 'Cannot proceed', 'Please make sure that the root path exists.')
180185
return
186+
if index.win_path(self.app_path).lower().startswith(root_path.lower()):
187+
QMessageBox.critical(self, 'Cannot proceed', 'Flashpoint Updater is found under the root path.\nPlease move it to a different location to proceed.')
188+
return
181189
self.update_button.setEnabled(False)
182190
current = str(self.from_combo_box.currentText())
183191
target = str(self.to_combo_box.currentText())

0 commit comments

Comments
 (0)