Skip to content

Commit

Permalink
Fix auto-updater
Browse files Browse the repository at this point in the history
  • Loading branch information
GuiBrandt committed Feb 19, 2019
1 parent 9b2be55 commit ea5d290
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 16 deletions.
17 changes: 2 additions & 15 deletions apply_update.py
Original file line number Diff line number Diff line change
@@ -1,29 +1,16 @@
"""Aplica a última atualização baixada
Esse arquivo é basicamente um `.cmd` glorificado
"""

import os
import os.path

if os.path.isdir(".update"):
# Atualiza tudo da pasta raíz
os.system("move /Y .update\\*.* .\\ >nul 2>nul")
os.system("move .update\\*.* .\\ >nul 2>nul")

# Cria e atualiza cada uma das subpastas necessárias
for subdir in os.walk(".update"):
dirname = subdir[0].replace(".update\\", '')

os.system(
f"if not exist .\\{dirname}" +
f" mkdir .\\{dirname} >nul 2>nul")

os.system(
f"move /Y .update\\{dirname}\\*.* .\\{dirname}\\ " +
f"move .update\\{dirname}\\*.* .\\{dirname}\\ " +
">nul 2>nul")

# Apaga a .update (agora vazia)
os.system("rmdir .update /s /q >nul 2>nul")

# Roda o god
os.system("start python .")
2 changes: 1 addition & 1 deletion god/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def check_updates():
with open(".version", "w") as version_file:
version_file.write(_VERSION)

# os.system("start python apply_update.py")
os.system("start python apply_update.py")
sys.exit(0)


Expand Down

0 comments on commit ea5d290

Please sign in to comment.