From 91b7e083c25c31a2e426837ff423a0e124ab2594 Mon Sep 17 00:00:00 2001 From: chmodsayshello Date: Tue, 29 Mar 2022 17:12:21 +0000 Subject: [PATCH] upload script --- tools/spacefix.py | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 tools/spacefix.py diff --git a/tools/spacefix.py b/tools/spacefix.py new file mode 100644 index 000000000..47b0e2969 --- /dev/null +++ b/tools/spacefix.py @@ -0,0 +1,46 @@ +#ONLY RUN FROM THE MCL5 TOOLS FOLDER! + + +__author__ = "chmodsayshello" +__license__ = "GPLv3" +__status__ = "Development" + +#the ironic thing about this file is that i am going to made many many space /tab mistakes here xD + +import os, sys + +mcl5_dir = os.path.join(os.getcwd(), os.pardir) + +print("Semi Warning: this only works if you run this from /tools, else its going to do it from any folder above from where you run it, just answer with 2 if thats the case") +print("") +print("WARNING: THIS IS GOING TO MAKE CHANGES WITHOUT ASKING YOU, MAKE A COPY OF YOUR CODE BEFORE RUNNING THIS!") +print("1: Continue") +print("2: Cancel") +print("") +answer = input("Please Enter 1 or 2, anthing else is invalid: ") + +if answer == "1": + print("Thanks for your permission :), starting...") +else: + if answer == "2": + sys.exit("Operation cancelled by user!") + else: + sys.exit("Invalid input") + + +for root, dirs, files in os.walk(mcl5_dir): + for name in files: + if name.endswith(".lua"): + mod = open(os.path.join(root, name),"r") + + line_original = mod.readlines() + + for i in range(0, len(line_original)): + line_original[i] = line_original[i].replace(" ", '\t') + + + mod.close() + mod = open(os.path.join(root, name), "w") + mod.writelines(line_original) + mod.close() +print("DONE! check if mcl5 still works!")