mirror of
https://gitlab.com/crafty-controller/crafty-4.git
synced 2024-08-30 18:23:09 +00:00
Fix pyinstaller pathing
This commit is contained in:
parent
2293257f89
commit
a6aa0f8679
17
main.py
17
main.py
@ -198,14 +198,21 @@ if __name__ == "__main__":
|
||||
controller.add_system_user()
|
||||
|
||||
if getattr(sys, "frozen", False):
|
||||
# If the application is run as a bundle, the PyInstaller bootloader
|
||||
# extends the sys module by a flag frozen=True and sets the app
|
||||
# path into variable _MEIPASS'.
|
||||
application_path = sys._MEIPASS
|
||||
application_path = os.path.dirname(sys.executable)
|
||||
running_mode = "Frozen/executable"
|
||||
else:
|
||||
application_path = os.path.dirname(os.path.abspath(__file__))
|
||||
try:
|
||||
app_full_path = os.path.realpath(__file__)
|
||||
application_path = os.path.dirname(app_full_path)
|
||||
running_mode = "Non-interactive (e.g. 'python main.py')"
|
||||
except NameError:
|
||||
application_path = os.getcwd()
|
||||
running_mode = "Interactive"
|
||||
|
||||
controller.set_project_root(application_path)
|
||||
Console.info(f"Execution Mode: {running_mode}")
|
||||
Console.info(f"Application path : '{application_path}'")
|
||||
|
||||
controller.clear_unexecuted_commands()
|
||||
controller.clear_support_status()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user