Skip to content

Commit

Permalink
fix: closes any running instances before install
Browse files Browse the repository at this point in the history
  • Loading branch information
ThiaudioTT committed Oct 20, 2023
1 parent fae205f commit 89c309c
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ def customInput() -> str | None:
print("This script will install the hoi4-presence in your game/save path\nPress enter to continue...")
customInput()

# 0 - Stop any running instances of hoi4Presence.exe
# 1 - Move hoi4Presence to documents/paradox/hearts of iron/ WITH CURRENTLY version.json and uninstaller.py
# 1.1 - If can't move, exit.
# 1.2 - If can't search, ask the user where is the path
Expand Down Expand Up @@ -81,6 +82,18 @@ def customInput() -> str | None:
time.sleep(10)
sys.exit()

# 0 - Stop any running instances of hoi4Presence.exe
# TODO: probably theres a better way to do this and this should be executed always
if IS_UPDATE:
print("Stopping any running instances of hoi4Presence.exe...")
result = os.system("taskkill /f /im hoi4Presence.exe")

if result == 0:
print("Process terminated successfully.")
else:
print("Error occurred while terminating the process.")
sys.exit(1)

# 1
documents = os.environ['USERPROFILE'] + "\\Documents\\Paradox Interactive\\Hearts of Iron IV"
while True:
Expand Down

0 comments on commit 89c309c

Please sign in to comment.