diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..7e99e36 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +*.pyc \ No newline at end of file diff --git a/winclient/deploy.py b/winclient/deploy.py index 8b8c520..6e88cd0 100644 --- a/winclient/deploy.py +++ b/winclient/deploy.py @@ -1,10 +1,61 @@ #!/usr/bin/env python import os +#import filever + +try: + input = raw_input +except NameError: + pass + +def path_join(names): + result = names[0] + for i in range(1, len(names)): + result = os.path.join(result, names[i]) + return result + +profile_path = None +if "HOME" in os.environ: + profile_path = os.environ["HOME"] +elif "USERPROFILE" in os.environ: + profile_path = os.environ["USERPROFILE"] +else: + try_path = "C:\\Users\\jgustafson" + if not os.path.isdir(try_path): try_path = "C:\\Users\\Owner" + + print("WARNING: no HOME or USERPROFILE found, reverting to '" + + try_path + "'") + profile_path = try_path +#region user settings deploy_path = "C:\\Games\\ENLIVEN-deploy" +installer_deploy_path = path_join( [profile_path, "ownCloud", "www", + "expertmultimedia", "downloads"] ) +installer_name = "install-ENLIVEN.exe" +#endregion user settings + +installer_path = os.path.join(installer_deploy_path, installer_name) + +if not os.path.isdir(installer_deploy_path): + print("#WARNING: does not exist:") +print("installer_deploy_path: " + installer_deploy_path) + +#this is a waste--it just shows 0.0.0.0 though iss file has version +#if os.path.isfile(installer_path): + #numbers=filever.get_version_number(installer_path) + #major,minor,subminor,revision = numbers + #print(".".join([str (i) for i in numbers])) + if not os.path.isdir(deploy_path): os.makedirs(deploy_path) games_path = os.path.join(deploy_path, "games") game_path = os.path.join(games_path, "ENLIVEN") +if not os.path.isdir(game_path): + print("") + print("ERROR: ENLIVEN must first be installed from web sources" + + " using the provided 'install' script in the etc/change*" + " folder and placed in " + game_path) + exit(1) +else: + print("game_path: " + game_path) mods_path = os.path.join(game_path, "mods") if not os.path.isdir(deploy_path): os.makedirs(mods_path) diff --git a/winclient/filever.py b/winclient/filever.py new file mode 100644 index 0000000..500ecce --- /dev/null +++ b/winclient/filever.py @@ -0,0 +1,26 @@ +#!/usr/bin/env python +#by Jamie at http://stackoverflow.com/questions/580924/python-windows-file-version-attribute +try: + from win32api import GetFileVersionInfo, LOWORD, HIWORD +except: + print("you need to install win32api such as with the command:") + print("python -m pip install --upgrade pip") + print("python -m pip install pypiwin32") + exit(1) + + from win32api import GetFileVersionInfo, LOWORD, HIWORD + +def get_version_number (filename): + try: + info = GetFileVersionInfo (filename, "\\") + ms = info['FileVersionMS'] + ls = info['FileVersionLS'] + return HIWORD (ms), LOWORD (ms), HIWORD (ls), LOWORD (ls) + except: + return 0,0,0,0 + +if __name__ == '__main__': + import os + filename = os.environ["COMSPEC"] + this_delimiter = "." + print(".".join ([str (i) for i in get_version_number (filename)]))