change to executable's working directory to find forge directory

This commit is contained in:
espeon65536 2021-08-08 14:19:36 -05:00 committed by Fabian Dill
parent b187223162
commit 527a9b49e2
1 changed files with 5 additions and 2 deletions

View File

@ -69,7 +69,7 @@ def replace_apmc_files(forge_dir, apmc_file):
os.remove(entry.path)
print(f"Removed existing .apmc files in {apdata_dir}")
copyfile(apmc_file, os.path.join(apdata_dir, os.path.basename(apmc_file)))
print(f"Copied {apmc_file} to {apdata_dir}")
print(f"Copied {os.path.basename(apmc_file)} to {apdata_dir}")
# Check mod version, download new mod from GitHub releases page if needed.
@ -135,10 +135,13 @@ if __name__ == '__main__':
args = parser.parse_args()
options = Utils.get_options()
apmc_file = args.apmc_file
apmc_file = os.path.abspath(args.apmc_file)
forge_dir = options["minecraft_options"]["forge_directory"]
max_heap = options["minecraft_options"]["max_heap_size"]
# Change to executable's working directory
os.chdir(os.path.abspath(os.path.dirname(sys.argv[0])))
if apmc_file is not None and not os.path.isfile(apmc_file):
raise FileNotFoundError(f"Path {apmc_file} does not exist or could not be accessed.")
if not os.path.isdir(forge_dir):