Skip to content

Commit

Permalink
Fixed a bug in the find_parent_directory FileSystem method that would…
Browse files Browse the repository at this point in the history
… erase parts of multi-matching filenames
  • Loading branch information
jmwright committed Mar 17, 2023
1 parent 25e80e2 commit 6f130ef
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 18 deletions.
8 changes: 7 additions & 1 deletion FileSystem.gd
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,13 @@ static func find_parent_dir(path):
var path_parts = path.split('/')

# Remove the directory/file from the end of the path
var par_path = path.replace(path_parts[-1], '')
path_parts.remove(path_parts.size() - 1)

# Reassemble the path without the end
var par_path = ""
for part in path_parts:
par_path += "/"
par_path += part

return par_path

Expand Down
28 changes: 11 additions & 17 deletions GUI.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -616,12 +616,11 @@ margin_bottom = 4.0
[node name="OpenDialog" type="FileDialog" parent="."]
margin_right = 760.0
margin_bottom = 381.0
rect_min_size = Vector2( 400, 140 )
window_title = "Open a File"
mode = 0
access = 2
filters = PoolStringArray( "*.py" )
current_dir = "/home/jwright/Downloads/repos/Semblage"
current_path = "/home/jwright/Downloads/repos/Semblage/"

[node name="ErrorDialog" type="AcceptDialog" parent="."]
margin_left = 200.0
Expand All @@ -635,41 +634,37 @@ margin_left = 100.0
margin_top = 100.0
margin_right = 740.0
margin_bottom = 580.0
rect_min_size = Vector2( 400, 140 )
window_title = "Export Component"
access = 2
current_dir = "/"
current_file = "component.stl"
current_path = "/component.stl"

[node name="SaveDialog" type="FileDialog" parent="."]
margin_right = 640.0
margin_bottom = 480.0
rect_min_size = Vector2( 400, 140 )
access = 2
filters = PoolStringArray( "*.py" )
current_dir = "/home/jwright/Downloads/repos/Semblage"
current_path = "/home/jwright/Downloads/repos/Semblage/"

[node name="ExportFileDialog" type="FileDialog" parent="."]
margin_right = 500.0
margin_bottom = 300.0
rect_min_size = Vector2( 400, 140 )
window_title = "Export to File"
access = 2
current_dir = "/home/jwright/Downloads/repos/Semblage"
current_path = "/home/jwright/Downloads/repos/Semblage/"

[node name="ImportFileDialog" type="FileDialog" parent="."]
margin_right = 315.0
margin_bottom = 130.0
rect_min_size = Vector2( 400, 140 )
window_title = "Open a File"
resizable = true
mode = 0
access = 2
current_dir = "/home/jwright/Downloads/repos/Semblage"
current_path = "/home/jwright/Downloads/repos/Semblage/"

[node name="ConfirmationDialog" type="ConfirmationDialog" parent="."]
margin_right = 200.0
margin_bottom = 70.0
rect_min_size = Vector2( 400, 140 )

[node name="ExportSVGDialog" type="WindowDialog" parent="."]
margin_right = 356.0
Expand Down Expand Up @@ -1479,10 +1474,10 @@ margin_right = 315.0
margin_bottom = 517.0

[node name="ColorPicker" type="ColorPicker" parent="ColorPickerDialog/PanelContainer/VBoxContainer"]
margin_left = 208.0
margin_top = 208.0
margin_right = 516.0
margin_bottom = 670.0
margin_left = 216.0
margin_top = 216.0
margin_right = 524.0
margin_bottom = 678.0

[node name="OkButton" type="Button" parent="ColorPickerDialog/PanelContainer/VBoxContainer"]
margin_top = 466.0
Expand Down Expand Up @@ -1640,10 +1635,9 @@ size_flags_vertical = 3
[node name="NewComponentDialog" type="FileDialog" parent="."]
margin_right = 640.0
margin_bottom = 480.0
rect_min_size = Vector2( 400, 140 )
access = 2
filters = PoolStringArray( "*.py" )
current_dir = "/home/jwright/Downloads/repos/Semblage"
current_path = "/home/jwright/Downloads/repos/Semblage/"

[connection signal="button_down" from="GUI/VBoxContainer/PanelContainer/Toolbar/OpenButton" to="." method="_on_OpenButton_button_down"]
[connection signal="button_down" from="GUI/VBoxContainer/PanelContainer/Toolbar/AddComponentButton" to="." method="_on_AddComponentButton_button_down"]
Expand Down
Binary file added gut_panel.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
35 changes: 35 additions & 0 deletions gut_panel.png.import
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
[remap]

importer="texture"
type="StreamTexture"
path="res://.import/gut_panel.png-51315c4dbef24e14bb14c0ee0272b7be.stex"
metadata={
"vram_texture": false
}

[deps]

source_file="res://gut_panel.png"
dest_files=[ "res://.import/gut_panel.png-51315c4dbef24e14bb14c0ee0272b7be.stex" ]

[params]

compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=true
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
process/normal_map_invert_y=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0

0 comments on commit 6f130ef

Please sign in to comment.