create missing directories when importing new custom sprites

This commit is contained in:
infinitefusion
2023-11-13 21:13:55 -05:00
parent a86b844649
commit d941ae48e9
2 changed files with 4 additions and 2 deletions

View File

@@ -75,14 +75,16 @@ def sortCustomBattlers()
next if !filename.end_with?(".png")
headNum = filename.split('.')[0]
oldPath = Settings::CUSTOM_BATTLERS_FOLDER + filename
newPath = Settings::CUSTOM_BATTLERS_FOLDER_INDEXED + headNum.to_s + "/" + filename
newDir = Settings::CUSTOM_BATTLERS_FOLDER_INDEXED + headNum.to_s
newPath = newDir + "/" + filename
begin
if File.file?(newPath)
alreadyExists[oldPath] = newPath
echo "\nFile " + newPath + " already exists... Skipping."
else
File.rename(oldPath, newPath)
Dir.mkdir(newDir) if !Dir.exist?(newDir)
File.rename(oldPath, newPath)
$game_temp.nb_imported_sprites+=1
echo "\nSorted " + filename + " into " + newPath
end