Add missing directories

This commit is contained in:
Michael Chen 2022-11-15 02:48:10 +01:00
parent 0f273674c5
commit f980220489
Signed by: cnml
GPG Key ID: 5845BF3F82D5F629

View File

@ -117,7 +117,7 @@ def calculate_hash(filename: Path):
def download_file(file: DownloadInfo, filename: Path):
if not filename.exists():
filename.parent.mkdir(exist_ok=True)
filename.parent.mkdir(exist_ok=True, parents=True)
print(f"Downloading new file {file['url']}")
urllib.request.urlretrieve(file["url"], filename)
sha1 = calculate_hash(filename)
@ -158,7 +158,7 @@ def build_version(manifest: VersionManifest, version_id: str, repository: str =
java_version = version['javaVersion']
print(
f"Version [{version['type']}] {version['id']} requires java version {java_version['majorVersion']} ({java_version['component']})")
server_jar_file = Path(f"versions/{version['id']}/server.jar")
server_jar_file = Path("versions") / version['id'] / "server.jar"
server_jar = version["downloads"]["server"]
download_file(server_jar, server_jar_file)