mirror of
https://github.com/Relintai/MemR.git
synced 2025-01-12 15:21:14 +01:00
Find unique filename if a file with the same name already exists at the target location.
This commit is contained in:
parent
869568db37
commit
713cd3a147
@ -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 )]
|
||||
|
@ -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:
|
||||
|
Loading…
Reference in New Issue
Block a user