mirror of
https://github.com/thegatesbrowser/thegates.git
synced 2025-08-23 17:17:31 -04:00
sandbox executable path
This commit is contained in:
parent
9a02682fb1
commit
48feba5041
4 changed files with 49 additions and 8 deletions
10
project/the_gates/resources/sandbox_executable.tres
Normal file
10
project/the_gates/resources/sandbox_executable.tres
Normal file
|
@ -0,0 +1,10 @@
|
|||
[gd_resource type="Resource" script_class="SandboxExecutable" load_steps=2 format=3 uid="uid://cmb7xvbue74qa"]
|
||||
|
||||
[ext_resource type="Script" path="res://the_gates/scripts/loading/sandbox_executable.gd" id="1_q0dqh"]
|
||||
|
||||
[resource]
|
||||
script = ExtResource("1_q0dqh")
|
||||
linux = "Sandbox.x86_64"
|
||||
linux_debug = "godot.linuxbsd.editor.dev.sandbox.x86_64.llvm"
|
||||
windows = "Sandbox.exe"
|
||||
windows_debug = "godot.linuxbsd.editor.dev.sandbox.x86_64.exe"
|
|
@ -1,9 +1,10 @@
|
|||
[gd_scene load_steps=36 format=3 uid="uid://kywrsqro3d5i"]
|
||||
[gd_scene load_steps=37 format=3 uid="uid://kywrsqro3d5i"]
|
||||
|
||||
[ext_resource type="Script" path="res://the_gates/scripts/loading/gate_loader.gd" id="1_coscx"]
|
||||
[ext_resource type="Resource" uid="uid://b1xvdym0qh6td" path="res://the_gates/resources/gate_events.res" id="2_ot8b0"]
|
||||
[ext_resource type="Script" path="res://the_gates/scripts/loading/sandbox_manager.gd" id="3_u7ft0"]
|
||||
[ext_resource type="Shader" path="res://the_gates/shaders/blur.gdshader" id="4_fnp53"]
|
||||
[ext_resource type="Resource" uid="uid://cmb7xvbue74qa" path="res://the_gates/resources/sandbox_executable.tres" id="4_s0qgl"]
|
||||
[ext_resource type="PackedScene" uid="uid://ctam0fxigbefk" path="res://the_gates/scenes/components/search.tscn" id="4_sg0oy"]
|
||||
[ext_resource type="Texture2D" uid="uid://bpj05amcrq1cq" path="res://the_gates/textures/slide-up.png" id="4_x2j1m"]
|
||||
[ext_resource type="Script" path="res://the_gates/scripts/ui/world/world_ui.gd" id="4_xatjs"]
|
||||
|
@ -82,7 +83,7 @@ gate_events = ExtResource("2_ot8b0")
|
|||
script = ExtResource("3_u7ft0")
|
||||
gate_events = ExtResource("2_ot8b0")
|
||||
render_result = NodePath("../WorldCanvas/RenderResult")
|
||||
sandbox_executable = "godot.linuxbsd.editor.dev.sandbox.x86_64.llvm"
|
||||
snbx_executable = ExtResource("4_s0qgl")
|
||||
|
||||
[node name="WorldCanvas" type="Control" parent="."]
|
||||
layout_mode = 3
|
||||
|
|
29
project/the_gates/scripts/loading/sandbox_executable.gd
Normal file
29
project/the_gates/scripts/loading/sandbox_executable.gd
Normal file
|
@ -0,0 +1,29 @@
|
|||
extends Resource
|
||||
class_name SandboxExecutable
|
||||
|
||||
@export var linux: String
|
||||
@export var linux_debug: String
|
||||
|
||||
@export var windows: String
|
||||
@export var windows_debug: String
|
||||
|
||||
var path: String :
|
||||
get = get_executable_path
|
||||
|
||||
|
||||
func get_executable_path() -> String:
|
||||
var executable_dir = OS.get_executable_path().get_base_dir() + "/"
|
||||
return executable_dir + get_filename()
|
||||
|
||||
|
||||
func get_filename() -> String:
|
||||
if OS.is_debug_build():
|
||||
if OS.get_name() == "Windows": return windows_debug
|
||||
else: return linux_debug
|
||||
else:
|
||||
if OS.get_name() == "Windows": return windows
|
||||
else: return linux
|
||||
|
||||
|
||||
func exists() -> bool:
|
||||
return FileAccess.file_exists(path)
|
|
@ -3,7 +3,7 @@ class_name SandboxManager
|
|||
|
||||
@export var gate_events: GateEvents
|
||||
@export var render_result: RenderResult
|
||||
@export var sandbox_executable: String
|
||||
@export var snbx_executable: SandboxExecutable
|
||||
|
||||
var sandbox_pid: int
|
||||
|
||||
|
@ -13,19 +13,20 @@ func _ready() -> void:
|
|||
|
||||
|
||||
func create_process(gate: Gate) -> void:
|
||||
var executable_dir = OS.get_executable_path().get_base_dir() + "/"
|
||||
var sandbox_path = executable_dir + sandbox_executable
|
||||
var pack_file = ProjectSettings.globalize_path(gate.resource_pack)
|
||||
if not snbx_executable.exists():
|
||||
Debug.logerr("Sandbox executable not found at " + snbx_executable.path); return
|
||||
|
||||
var pack_file = ProjectSettings.globalize_path(gate.resource_pack)
|
||||
var args = [
|
||||
"--main-pack", pack_file,
|
||||
"--resolution", "%dx%d" % [render_result.width, render_result.height],
|
||||
"--fd-path", render_result.fd_path
|
||||
]
|
||||
Debug.logclr(sandbox_path + " " + " ".join(args), Color.DARK_VIOLET)
|
||||
sandbox_pid = OS.create_process(sandbox_path, args)
|
||||
Debug.logclr(snbx_executable.path + " " + " ".join(args), Color.DARK_VIOLET)
|
||||
sandbox_pid = OS.create_process(snbx_executable.path, args)
|
||||
|
||||
if OS.get_name() == "Windows": render_result.fd_path += "|" + str(sandbox_pid)
|
||||
|
||||
gate_events.gate_entered_emit()
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue