Added maindir, projectdir and cba variables

This commit is contained in:
jonpas 2015-05-22 20:12:41 +02:00
parent 9536423f2e
commit 0b70c04468

View File

@ -12,6 +12,11 @@ import platform
import subprocess
import winreg
######## GLOBALS #########
maindir = "z"
projectdir = "ace"
cba = "P:\\x\\cba"
##########################
def main():
print("""
@ -60,26 +65,26 @@ def main():
print("\n# Creating links ...")
if os.path.exists("P:\\z\\ace"):
if os.path.exists("P:\\{}\\{}".format(maindir,projectdir)):
print("Link on P: already exists. Please finish the setup manually.")
return 4
if os.path.exists(os.path.join(armapath, "z", "ace")):
if os.path.exists(os.path.join(armapath, maindir, projectdir)):
print("Link in Arma directory already exists. Please finish the setup manually.")
return 5
try:
if not os.path.exists("P:\\z"):
os.mkdir("P:\\z")
if not os.path.exists(os.path.join(armapath, "z")):
os.mkdir(os.path.join(armapath, "z"))
if not os.path.exists("P:\\" + maindir):
os.mkdir("P:\\" + maindir)
if not os.path.exists(os.path.join(armapath, maindir)):
os.mkdir(os.path.join(armapath, maindir))
if platform.win32_ver()[0] == "7":
subprocess.call(["cmd", "/c", "mklink", "/D", "P:\\z\\ace", projectpath])
subprocess.call(["cmd", "/c", "mklink", "/D", os.path.join(armapath, "z", "ace"), projectpath])
subprocess.call(["cmd", "/c", "mklink", "/D", "P:\\{}\\{}".format(maindir,projectdir), projectpath])
subprocess.call(["cmd", "/c", "mklink", "/D", os.path.join(armapath, maindir, projectdir), projectpath])
else:
subprocess.call(["cmd", "/c", "mklink", "/D", "/J", "P:\\z\\ace", projectpath])
subprocess.call(["cmd", "/c", "mklink", "/D", "/J", os.path.join(armapath, "z", "ace"), projectpath])
subprocess.call(["cmd", "/c", "mklink", "/D", "/J", "P:\\{}\\{}".format(maindir,projectdir), projectpath])
subprocess.call(["cmd", "/c", "mklink", "/D", "/J", os.path.join(armapath, maindir, projectdir), projectpath])
except:
raise
print("Something went wrong during the link creation. Please finish the setup manually.")
@ -90,18 +95,18 @@ def main():
print("\n# Copying required CBA includes ...")
if os.path.exists("P:\\x\\cba"):
print("P:\\x\\cba already exists, skipping.")
if os.path.exists(cba):
print(cba + " already exists, skipping.")
return -1
try:
shutil.copytree(os.path.join(projectpath, "tools", "cba"), "P:\\x\\cba")
shutil.copytree(os.path.join(projectpath, "tools", "cba"), cba)
except:
raise
print("Something went wrong while copying CBA includes. Please copy tools\\cba to P:\\x\\cba manually.")
print("Something went wrong while copying CBA includes. Please copy tools\\cba to {} manually.".format(cba))
return 7
print("# CBA includes copied successfully to P:\\x\\cba.")
print("# CBA includes copied successfully to {}.".format(cba))
return 0