|
2 | 2 | import os |
3 | 3 | import sys |
4 | 4 |
|
| 5 | +# If Grabber is run from start menu, working directory is set to system32, this changes to file location. |
| 6 | +if os.getcwd().lower() == r'c:\windows\system32'.lower(): # Bit of a hack, but if you have this, your fault |
| 7 | + # Check if running as script, or executable. |
| 8 | + if getattr(sys, 'frozen', False): |
| 9 | + application_path = os.path.dirname(sys.executable) |
| 10 | + else: |
| 11 | + application_path = os.path.dirname(__file__) |
| 12 | + os.chdir(os.path.realpath(application_path)) |
| 13 | + |
5 | 14 | from PyQt5.QtCore import Qt |
6 | 15 | from PyQt5.QtWidgets import QApplication, QMessageBox |
7 | 16 |
|
|
10 | 19 | from utils.utilities import SettingsError, ProfileLoadError |
11 | 20 |
|
12 | 21 |
|
13 | | -# TODO: Notify on failure to write settings/profiles |
14 | 22 | def main(): |
15 | 23 | while True: |
16 | 24 | try: |
17 | | - # If Grabber is run from start menu search, under specific conditions, |
18 | | - # working directory is set to system32, this changes to file location as to not break anything. |
19 | | - |
20 | | - if os.getcwd().lower() == r'c:\windows\system32'.lower(): # Bit of a hack, but if you have this, your fault |
21 | | - # Check if running as script, or executable. |
22 | | - if getattr(sys, 'frozen', False): |
23 | | - application_path = os.path.dirname(sys.executable) |
24 | | - else: |
25 | | - application_path = os.path.dirname(__file__) |
26 | | - os.chdir(os.path.realpath(application_path)) |
27 | | - |
28 | 25 | app = QApplication(sys.argv) |
29 | 26 | program = GUI() |
30 | 27 |
|
|
0 commit comments