ensure paths work on MacOS

This commit is contained in:
xananax prozaxx 2023-04-26 00:31:12 +02:00
parent f94a0e89d6
commit 8888572829
2 changed files with 41 additions and 37 deletions

View File

@ -90,10 +90,14 @@ func _on_attributions_rich_text_label_meta_clicked(meta) -> void:
func _on_open_data_dir_button_pressed() -> void: func _on_open_data_dir_button_pressed() -> void:
# warning-ignore:return_value_discarded _open_path(OS.get_user_data_dir())
OS.shell_open(OS.get_user_data_dir())
func _on_file_path_open_button_pressed() -> void: 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 # warning-ignore:return_value_discarded
OS.shell_open(config.current_timesheet_file_path.get_base_dir()) OS.shell_open("file://"+canonical_path)

View File

@ -10,87 +10,87 @@ size_flags_vertical = 3
script = ExtResource( 1 ) script = ExtResource( 1 )
[node name="VBoxContainer" type="VBoxContainer" parent="."] [node name="VBoxContainer" type="VBoxContainer" parent="."]
margin_right = 360.0 margin_right = 505.0
margin_bottom = 760.0 margin_bottom = 760.0
size_flags_horizontal = 3 size_flags_horizontal = 3
size_flags_vertical = 3 size_flags_vertical = 3
[node name="HBoxContainer" type="HBoxContainer" parent="VBoxContainer"] [node name="HBoxContainer" type="HBoxContainer" parent="VBoxContainer"]
margin_right = 360.0 margin_right = 505.0
margin_bottom = 24.0 margin_bottom = 45.0
size_flags_horizontal = 3 size_flags_horizontal = 3
[node name="Label" type="Label" parent="VBoxContainer/HBoxContainer"] [node name="Label" type="Label" parent="VBoxContainer/HBoxContainer"]
margin_top = 5.0 margin_top = 10.0
margin_right = 55.0 margin_right = 92.0
margin_bottom = 19.0 margin_bottom = 35.0
text = "File Path" text = "File Path"
[node name="FilePathLineEdit" type="LineEdit" parent="VBoxContainer/HBoxContainer"] [node name="FilePathLineEdit" type="LineEdit" parent="VBoxContainer/HBoxContainer"]
unique_name_in_owner = true unique_name_in_owner = true
margin_left = 59.0 margin_left = 100.0
margin_right = 223.0 margin_right = 264.0
margin_bottom = 24.0 margin_bottom = 45.0
size_flags_horizontal = 3 size_flags_horizontal = 3
caret_blink = true caret_blink = true
caret_blink_speed = 0.5 caret_blink_speed = 0.5
[node name="FilePathButton" type="Button" parent="VBoxContainer/HBoxContainer"] [node name="FilePathButton" type="Button" parent="VBoxContainer/HBoxContainer"]
unique_name_in_owner = true unique_name_in_owner = true
margin_left = 227.0 margin_left = 272.0
margin_right = 251.0 margin_right = 314.0
margin_bottom = 24.0 margin_bottom = 45.0
text = "..." text = "..."
[node name="FilePathOpenButton" type="Button" parent="VBoxContainer/HBoxContainer"] [node name="FilePathOpenButton" type="Button" parent="VBoxContainer/HBoxContainer"]
unique_name_in_owner = true unique_name_in_owner = true
margin_left = 255.0 margin_left = 322.0
margin_right = 360.0 margin_right = 505.0
margin_bottom = 24.0 margin_bottom = 45.0
text = "open directory" text = "open directory"
[node name="HBoxContainer2" type="HBoxContainer" parent="VBoxContainer"] [node name="HBoxContainer2" type="HBoxContainer" parent="VBoxContainer"]
margin_top = 28.0 margin_top = 53.0
margin_right = 360.0 margin_right = 505.0
margin_bottom = 48.0 margin_bottom = 90.0
size_flags_horizontal = 3 size_flags_horizontal = 3
[node name="Label" type="Label" parent="VBoxContainer/HBoxContainer2"] [node name="Label" type="Label" parent="VBoxContainer/HBoxContainer2"]
margin_top = 3.0 margin_top = 6.0
margin_right = 118.0 margin_right = 199.0
margin_bottom = 17.0 margin_bottom = 31.0
text = "Alternative Theme" text = "Alternative Theme"
[node name="ThemePathButton" type="Button" parent="VBoxContainer/HBoxContainer2"] [node name="ThemePathButton" type="Button" parent="VBoxContainer/HBoxContainer2"]
unique_name_in_owner = true unique_name_in_owner = true
margin_left = 122.0 margin_left = 207.0
margin_right = 161.0 margin_right = 278.0
margin_bottom = 20.0 margin_bottom = 37.0
text = "load" text = "load"
[node name="HBoxContainer3" type="HBoxContainer" parent="VBoxContainer"] [node name="HBoxContainer3" type="HBoxContainer" parent="VBoxContainer"]
margin_top = 52.0 margin_top = 98.0
margin_right = 360.0 margin_right = 505.0
margin_bottom = 76.0 margin_bottom = 146.0
size_flags_horizontal = 3 size_flags_horizontal = 3
[node name="SoundCheckBox" type="CheckBox" parent="VBoxContainer/HBoxContainer3"] [node name="SoundCheckBox" type="CheckBox" parent="VBoxContainer/HBoxContainer3"]
unique_name_in_owner = true unique_name_in_owner = true
margin_right = 74.0 margin_right = 134.0
margin_bottom = 24.0 margin_bottom = 48.0
text = "sounds" text = "sounds"
[node name="OpenDataDirButton" type="Button" parent="VBoxContainer"] [node name="OpenDataDirButton" type="Button" parent="VBoxContainer"]
unique_name_in_owner = true unique_name_in_owner = true
margin_top = 80.0 margin_top = 154.0
margin_right = 360.0 margin_right = 505.0
margin_bottom = 100.0 margin_bottom = 191.0
text = "Open data dir" text = "Open data dir"
[node name="AttributionsRichTextLabel" type="RichTextLabel" parent="VBoxContainer"] [node name="AttributionsRichTextLabel" type="RichTextLabel" parent="VBoxContainer"]
unique_name_in_owner = true unique_name_in_owner = true
margin_top = 104.0 margin_top = 199.0
margin_right = 360.0 margin_right = 505.0
margin_bottom = 760.0 margin_bottom = 760.0
size_flags_vertical = 3 size_flags_vertical = 3
theme_type_variation = "small_text" theme_type_variation = "small_text"