From 8888572829733d5071541d725579ff6c0bc5d0f8 Mon Sep 17 00:00:00 2001 From: Xananax Date: Wed, 26 Apr 2023 00:31:12 +0200 Subject: [PATCH] ensure paths work on MacOS --- ui/settings.gd | 10 ++++--- ui/settings.tscn | 68 ++++++++++++++++++++++++------------------------ 2 files changed, 41 insertions(+), 37 deletions(-) diff --git a/ui/settings.gd b/ui/settings.gd index f8dfae8..3c0bb72 100644 --- a/ui/settings.gd +++ b/ui/settings.gd @@ -90,10 +90,14 @@ func _on_attributions_rich_text_label_meta_clicked(meta) -> void: func _on_open_data_dir_button_pressed() -> void: - # warning-ignore:return_value_discarded - OS.shell_open(OS.get_user_data_dir()) + _open_path(OS.get_user_data_dir()) func _on_file_path_open_button_pressed() -> void: + _open_path(config.current_timesheet_file_path.get_base_dir()) + + +func _open_path(path: String): + var canonical_path := ProjectSettings.globalize_path(path).strip_edges() # warning-ignore:return_value_discarded - OS.shell_open(config.current_timesheet_file_path.get_base_dir()) + OS.shell_open("file://"+canonical_path) diff --git a/ui/settings.tscn b/ui/settings.tscn index 9c069bb..e374030 100644 --- a/ui/settings.tscn +++ b/ui/settings.tscn @@ -10,87 +10,87 @@ size_flags_vertical = 3 script = ExtResource( 1 ) [node name="VBoxContainer" type="VBoxContainer" parent="."] -margin_right = 360.0 +margin_right = 505.0 margin_bottom = 760.0 size_flags_horizontal = 3 size_flags_vertical = 3 [node name="HBoxContainer" type="HBoxContainer" parent="VBoxContainer"] -margin_right = 360.0 -margin_bottom = 24.0 +margin_right = 505.0 +margin_bottom = 45.0 size_flags_horizontal = 3 [node name="Label" type="Label" parent="VBoxContainer/HBoxContainer"] -margin_top = 5.0 -margin_right = 55.0 -margin_bottom = 19.0 +margin_top = 10.0 +margin_right = 92.0 +margin_bottom = 35.0 text = "File Path" [node name="FilePathLineEdit" type="LineEdit" parent="VBoxContainer/HBoxContainer"] unique_name_in_owner = true -margin_left = 59.0 -margin_right = 223.0 -margin_bottom = 24.0 +margin_left = 100.0 +margin_right = 264.0 +margin_bottom = 45.0 size_flags_horizontal = 3 caret_blink = true caret_blink_speed = 0.5 [node name="FilePathButton" type="Button" parent="VBoxContainer/HBoxContainer"] unique_name_in_owner = true -margin_left = 227.0 -margin_right = 251.0 -margin_bottom = 24.0 +margin_left = 272.0 +margin_right = 314.0 +margin_bottom = 45.0 text = "..." [node name="FilePathOpenButton" type="Button" parent="VBoxContainer/HBoxContainer"] unique_name_in_owner = true -margin_left = 255.0 -margin_right = 360.0 -margin_bottom = 24.0 +margin_left = 322.0 +margin_right = 505.0 +margin_bottom = 45.0 text = "open directory" [node name="HBoxContainer2" type="HBoxContainer" parent="VBoxContainer"] -margin_top = 28.0 -margin_right = 360.0 -margin_bottom = 48.0 +margin_top = 53.0 +margin_right = 505.0 +margin_bottom = 90.0 size_flags_horizontal = 3 [node name="Label" type="Label" parent="VBoxContainer/HBoxContainer2"] -margin_top = 3.0 -margin_right = 118.0 -margin_bottom = 17.0 +margin_top = 6.0 +margin_right = 199.0 +margin_bottom = 31.0 text = "Alternative Theme" [node name="ThemePathButton" type="Button" parent="VBoxContainer/HBoxContainer2"] unique_name_in_owner = true -margin_left = 122.0 -margin_right = 161.0 -margin_bottom = 20.0 +margin_left = 207.0 +margin_right = 278.0 +margin_bottom = 37.0 text = "load" [node name="HBoxContainer3" type="HBoxContainer" parent="VBoxContainer"] -margin_top = 52.0 -margin_right = 360.0 -margin_bottom = 76.0 +margin_top = 98.0 +margin_right = 505.0 +margin_bottom = 146.0 size_flags_horizontal = 3 [node name="SoundCheckBox" type="CheckBox" parent="VBoxContainer/HBoxContainer3"] unique_name_in_owner = true -margin_right = 74.0 -margin_bottom = 24.0 +margin_right = 134.0 +margin_bottom = 48.0 text = "sounds" [node name="OpenDataDirButton" type="Button" parent="VBoxContainer"] unique_name_in_owner = true -margin_top = 80.0 -margin_right = 360.0 -margin_bottom = 100.0 +margin_top = 154.0 +margin_right = 505.0 +margin_bottom = 191.0 text = "Open data dir" [node name="AttributionsRichTextLabel" type="RichTextLabel" parent="VBoxContainer"] unique_name_in_owner = true -margin_top = 104.0 -margin_right = 360.0 +margin_top = 199.0 +margin_right = 505.0 margin_bottom = 760.0 size_flags_vertical = 3 theme_type_variation = "small_text"