gif importer 安全优化:防止重复导入

This commit is contained in:
cakipaul 2025-01-30 22:01:57 +08:00
parent 72b3814e09
commit 900b3e2df4

View File

@ -78,7 +78,9 @@ func _import(source_file, save_path, options, platform_variants, gen_files):
var animation_name = source_file.get_file().replace(".gif", "")
var dir_name = base_dir + "/" + animation_name + "/"
if DirAccess.dir_exists_absolute(dir_name):
DirAccess.remove_absolute(dir_name)
# 如果文件夹存在,就不再重新导入
# 也就是说,重新导入的前提是删除 gif 同名文件夹
return code
DirAccess.make_dir_absolute(dir_name)
var sprite_frames_path = base_dir + "/frames.tres"
var sprite_frames: SpriteFrames