Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed setup_path() asking for confirmation twice #19

Closed
wants to merge 9 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 13 additions & 22 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,34 +50,25 @@ def sourcemods_path():
except Exception:
return None

def setup_path(manual_path):
def setup_path():
"""
Choose setup path.
"""
confirm = False
if sourcemods_path() is not None:
vars.INSTALL_PATH = sourcemods_path().rstrip('\"')

smodsfound = isinstance(vars.INSTALL_PATH, str)
if smodsfound is True and manual_path is not True:
gui.message(lang["setup_found"] % vars.INSTALL_PATH)
if gui.message_yes_no(lang["setup_found_question"]):
confirm = True
else:
setup_path(True)
path = sourcemods_path()
if path is not None:
gui.message('Sourcemods folder was automatically found at: ' + path)
if gui.message_yes_no('It\'s the recommended installation location. Would you like to install TF2Classic there?'):
vars.INSTALL_PATH = path.strip('\"')
return
if gui.message_yes_no('Would you like to extract in ' + getcwd() + '? You must move it to your sourcemods manually.'):
vars.INSTALL_PATH = getcwd()
else:
gui.message(lang["setup_not_found"])
if gui.message_yes_no(lang["setup_not_found_question"] % getcwd()):
vars.INSTALL_PATH = getcwd()
confirm = True
path = gui.message_dir('Please, enter the location in which TF2Classic will be installed to.\n')
if gui.message_yes_no('TF2Classic will be installed in ' + path + '\nDo you accept?'):
vars.INSTALL_PATH = path
else:
vars.INSTALL_PATH = gui.message_dir(lang["setup_input"])

if not confirm:
if not gui.message_yes_no(lang["setup_accept"] % vars.INSTALL_PATH):
print(lang["setup_reset"])
setup_path(False)
gui.message('Resetting...\n')
setup_path()

def setup_binaries():
"""
Expand Down
7 changes: 4 additions & 3 deletions tf2c_downloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@
Master module. Runs basic checks and then offloads all
of the real work to functions defined in other files.
"""
import ctypes
import os
import signal
import traceback
import ctypes
from platform import system
from shutil import which
from subprocess import run
Expand Down Expand Up @@ -40,9 +41,10 @@ def sanity_check():
if not stdin or not stdin.isatty():
print(lang["running_background"])
exit(1)

try:
sanity_check()
setup.setup_path(False)
setup.setup_path()
setup.setup_binaries()
install.free_space_check()
install.tf2c_download()
Expand All @@ -59,5 +61,4 @@ def sanity_check():
input(lang["exit"])
exit(1)


gui.message_end(lang["success"], 0)