From facc24d945c00bb17696f7597e9f376958c29bc4 Mon Sep 17 00:00:00 2001 From: poikilos <7557867+poikilos@users.noreply.github.com> Date: Sat, 7 Jan 2023 18:33:16 -0500 Subject: [PATCH] Fix: creating directories incorrectly on non-Windows systems; raise ValueError on missing profile variable. --- deploy.py | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/deploy.py b/deploy.py index 076a658..99efee5 100644 --- a/deploy.py +++ b/deploy.py @@ -43,6 +43,10 @@ def main(): elif "USERPROFILE" in os.environ: profile_path = os.environ["USERPROFILE"] else: + raise ValueError( + "HOME and USERPROFILE aren't set. This should never happen." + ) + ''' try_path = "C:\\Users\\jgustafson" if not os.path.isdir(try_path): try_path = "C:\\Users\\Owner" @@ -50,13 +54,20 @@ def main(): echo0("WARNING: no HOME or USERPROFILE found, reverting to '" + try_path + "'") profile_path = try_path + ''' # TODO: Make a settings file for values in the next region. - # region user settings + # region user settings + deploy_path = "C:\\Games\\ENLIVEN-deploy" + ''' try_path = "C:\\Games\\Minetest" - if (not os.path.isdir(deploy_path)) and os.path.isdir(try_path): - deploy_path = try_path - installer_deploy_path = path_join_all([profile_path, "ownCloud", "www", + if (not os.path.isdir(deploy_path)): + if os.path.isdir(try_path): + deploy_path = try_path + # else make the default one further down + ''' + # ^ The path must match the one in projects/setup-ENLIVEN-win64.iss + installer_deploy_path = path_join_all([profile_path, "Nextcloud", "www", "expertmultimedia", "downloads"]) installer_name = "install-ENLIVEN.exe" # endregion user settings @@ -74,6 +85,11 @@ def main(): # print(".".join([str (i) for i in numbers])) if not os.path.isdir(deploy_path): + if platform.system() != "Windows": + raise RuntimeError( + "A proper tmp deploy path for {} is not defined." + "".format(platform.system()) + ) os.makedirs(deploy_path) games_path = os.path.join(deploy_path, "games") minetest_game_path = os.path.join(games_path, "minetest_game")