From 77b396970ee564c79a12e38c70846ec6d6b200b6 Mon Sep 17 00:00:00 2001 From: infinitefusion Date: Thu, 27 Apr 2023 12:14:43 -0400 Subject: [PATCH] Automatically create folder if it doesn't exist when downloading custom sprites --- Data/Scripts/050_AddOns/HttpCalls.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Data/Scripts/050_AddOns/HttpCalls.rb b/Data/Scripts/050_AddOns/HttpCalls.rb index fae6171e9..2d7ccba5e 100644 --- a/Data/Scripts/050_AddOns/HttpCalls.rb +++ b/Data/Scripts/050_AddOns/HttpCalls.rb @@ -68,6 +68,10 @@ def download_custom_sprite(head_id, body_id) #base_path = "https://raw.githubusercontent.com/Aegide/custom-fusion-sprites/main/CustomBattlers/{1}.{2}.png" url = "https://raw.githubusercontent.com/infinitefusion/sprites/main/CustomBattlers/{1}.{2}.png" destPath = _INTL("{1}{2}", Settings::CUSTOM_BATTLERS_FOLDER_INDEXED, head_id) + if !Dir.exist?(destPath) + Dir.mkdir(destPath) + end + sprite = download_sprite(_INTL(url, head_id, body_id), head_id, body_id, destPath) return sprite if sprite return nil