Skip to content

Commit

Permalink
Abort update if the updater is found under the root path
Browse files Browse the repository at this point in the history
  • Loading branch information
puigru committed Jun 6, 2020
1 parent 97ba7aa commit 8c3361d
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions update_gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,11 @@ def __init__(self, server, parent=None):
self.step_unit = None
self.progress = 0

if getattr(sys, 'frozen', False):
self.app_path = os.path.abspath(sys.executable)
else:
self.app_path = os.path.abspath(__file__)

self.root_path = QLineEdit()
self.root_path.textChanged[str].connect(self.on_path_changed)
self.browse_button = QPushButton('Browse...')
Expand Down Expand Up @@ -178,6 +183,9 @@ def on_update_button(self):
if not os.path.isdir(root_path):
QMessageBox.critical(self, 'Cannot proceed', 'Please make sure that the root path exists.')
return
if index.win_path(self.app_path).lower().startswith(root_path.lower()):
QMessageBox.critical(self, 'Cannot proceed', 'Flashpoint Updater is found under the root path.\nPlease move it to a different location to proceed.')
return
self.update_button.setEnabled(False)
current = str(self.from_combo_box.currentText())
target = str(self.to_combo_box.currentText())
Expand Down

0 comments on commit 8c3361d

Please sign in to comment.