print("Usage: RimWorld_TranslationUpgrader.py <Directory> <Output>, where <Directory> is the translation to upgrade"
          "and <Output> is the output folder.")


# Save the arguments
arguments = sys.argv[1:]
# Save the directory in a variable
if len(arguments) == 2:
    transPath = os.path.abspath(arguments[0])
    outPath = os.path.abspath(arguments[1])
# If incorrect number of arguments then print help
elif not arguments:
    print_help()
    sys.exit(2)
else:
    rwtutil.print_help_error()
    sys.exit(2)

# Check if the entered RimWorld installation folder was correct
if transPath == outPath:  # input and output paths are the same
    print("Input and output directories can't be the same.")
    sys.exit(2)
# input path doesn't exist
if not os.path.exists(transPath):
    print("Directory is invalid.")
    sys.exit(2)
# input path doesn't have 'DefInjected' and 'Keyed' folders
if not (os.path.exists(os.path.join(transPath, "DefInjected")) and os.path.exists(os.path.join(transPath, "Keyed"))):
    print("Directory is invalid.")
    sys.exit(2)
# templates don't exist
    print("Simplifies multi-line path translations to the new simpler syntax.")
    print("Usage: RimWorld_SimplifyPathTranslations.py <Directory>")


# Save the arguments
arguments = sys.argv[1:]
# Save the directories in variables
if len(arguments) == 1:
    translationDirPath = arguments[0]
# If incorrect number of arguments then print help
elif not arguments:
    printhelp()
    sys.exit(2)
else:
    printhelp()
    rwtutil.print_help_error()
    sys.exit(2)

# Print information about the script
print("--------------------------------------------------------------------")
print("RimWorld Path Simplification Script")
print("")
print("Directory is \"" + translationDirPath + "\"")
print("--------------------------------------------------------------------")
print("")

translationDirPath = os.path.join(translationDirPath, 'DefInjected')

# Check if the entered RimWorld installation folder was correct
if not os.path.exists(translationDirPath):
    print("Directory is invalid.")