properly update and use server_dir from ServerUI
This commit is contained in:
parent
8cbfffba94
commit
836c101e6f
6
Main.gd
6
Main.gd
@ -66,7 +66,7 @@ func _serve_file(_request: HTTPServer.Request, response: HTTPServer.Response, bi
|
|||||||
var file_name: String = binds[0] as String
|
var file_name: String = binds[0] as String
|
||||||
|
|
||||||
var f := File.new()
|
var f := File.new()
|
||||||
var success = f.open("res://server_files/%s" % file_name, File.READ)
|
var success = f.open(server_dir.plus_file(file_name), File.READ)
|
||||||
|
|
||||||
if success == OK:
|
if success == OK:
|
||||||
var mime := mime_types.get(file_name)
|
var mime := mime_types.get(file_name)
|
||||||
@ -88,3 +88,7 @@ func _on_ServerUI_start_server_button_pressed(port: int, new_dir: String) -> voi
|
|||||||
|
|
||||||
func _on_ServerUI_stop_server_button_pressed() -> void:
|
func _on_ServerUI_stop_server_button_pressed() -> void:
|
||||||
_stop_server()
|
_stop_server()
|
||||||
|
|
||||||
|
|
||||||
|
func _on_ServerUI_server_folder_changed(new_path: String) -> void:
|
||||||
|
server_dir = new_path
|
||||||
|
@ -10,5 +10,6 @@ script = ExtResource( 1 )
|
|||||||
|
|
||||||
[node name="ServerUI" parent="." instance=ExtResource( 2 )]
|
[node name="ServerUI" parent="." instance=ExtResource( 2 )]
|
||||||
|
|
||||||
|
[connection signal="server_folder_changed" from="ServerUI" to="." method="_on_ServerUI_server_folder_changed"]
|
||||||
[connection signal="start_server_button_pressed" from="ServerUI" to="." method="_on_ServerUI_start_server_button_pressed"]
|
[connection signal="start_server_button_pressed" from="ServerUI" to="." method="_on_ServerUI_start_server_button_pressed"]
|
||||||
[connection signal="stop_server_button_pressed" from="ServerUI" to="." method="_on_ServerUI_stop_server_button_pressed"]
|
[connection signal="stop_server_button_pressed" from="ServerUI" to="." method="_on_ServerUI_stop_server_button_pressed"]
|
||||||
|
Loading…
Reference in New Issue
Block a user