diff --git a/game/Main.tscn b/game/Main.tscn index a6da28f..5552338 100644 --- a/game/Main.tscn +++ b/game/Main.tscn @@ -18,23 +18,16 @@ anchor_bottom = 0.0 margin_right = 900.0 margin_bottom = 1000.0 -[node name="VBoxContainer" parent="Menu" index="0"] -margin_right = 900.0 -margin_bottom = 1000.0 - [node name="Sort" parent="Menu/VBoxContainer" index="0"] margin_top = 413.0 -margin_right = 900.0 margin_bottom = 455.0 [node name="Settings" parent="Menu/VBoxContainer" index="1"] margin_top = 479.0 -margin_right = 900.0 margin_bottom = 521.0 [node name="Exit" parent="Menu/VBoxContainer" index="2"] margin_top = 545.0 -margin_right = 900.0 margin_bottom = 587.0 [node name="Settings" parent="." instance=ExtResource( 3 )] diff --git a/game/sort/Sort.gd b/game/sort/Sort.gd index 30147ff..9089407 100644 --- a/game/sort/Sort.gd +++ b/game/sort/Sort.gd @@ -229,9 +229,17 @@ func _on_Apply_pressed() -> void: if _sub_categories_ob.selected > 0: targetf = targetf.append_path(_sub_categories_ob.get_item_text(_sub_categories_ob.selected)) - targetf = targetf.plus_file(cimagefn.get_file()) - var dir : Directory = Directory.new() + + var target_filename : String = cimagefn.get_file() + var targetf_check : String = targetf.plus_file(target_filename) + var index : int = 0 + while dir.file_exists(targetf_check): + targetf_check = targetf.plus_file(target_filename.get_basename() + "_" + str(index) + "." + target_filename.get_extension()) + index += 1 + + targetf = targetf_check + var err : int = dir.copy(cimagefn, targetf) if err != OK: