Used new notice() to notify user if executable file doesn't exist. (And re-install in that case too)

This commit is contained in:
Noah 2022-10-28 15:41:44 -05:00
parent cd6396cada
commit fc21c328e4
2 changed files with 18 additions and 14 deletions

View File

@ -48,7 +48,6 @@ func _process(_delta):
# When everything is loaded,
func _ready():
# Determine the os_name
if OS.get_name() == "X11": # X11 is linuxy-based
os_name = "linux"
@ -144,13 +143,19 @@ func _on_Play_button_pressed():
# If not,
# Play the game
else:
# Attempt to execute the UltraFlare executable
var exit_code = OS.execute(OS.get_config_dir()+"/UltraFlare/current/UltraFlare-"+os_name+"-x86_64"+suffix, [], false)
# Check if there's an executable installed
if File.new().file_exists(OS.get_config_dir()+"/UltraFlare/current/UltraFlare-"+os_name+"-x86_64"+suffix):
# Attempt to execute the UltraFlare executable
var exit_code = OS.execute(OS.get_config_dir()+"/UltraFlare/current/UltraFlare-"+os_name+"-x86_64"+suffix, [], false)
# If the exit_code is anything other than -1,
if exit_code != -1:
# Close the launcher, the game should have started
get_tree().quit()
# If not, print out a debug message with the exit code
# If the exit_code is anything other than -1,
if exit_code != -1:
# Close the launcher, the game should have started
get_tree().quit()
# If not, print out a debug message with the exit code
else:
print("Running UltraFlare failed with code: "+exit_code)
# If not,
else:
print("Running UltraFlare failed with code: "+exit_code)
notice("Executable not found! Click 'UPDATE' to install it again", "alert")
Store.write_store("current_version", "")

View File

@ -4,7 +4,6 @@
[ext_resource path="res://Notice_msg.gd" type="Script" id=2]
[sub_resource type="DynamicFont" id=1]
size = 24
extra_spacing_char = 4
font_data = ExtResource( 1 )
@ -37,7 +36,7 @@ tracks/1/keys = {
[sub_resource type="Animation" id=3]
resource_name = "move_off_screen"
length = 0.3
length = 0.5
tracks/0/type = "value"
tracks/0/path = NodePath("Label:rect_position")
tracks/0/interp = 1
@ -45,10 +44,10 @@ tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/keys = {
"times": PoolRealArray( 0, 0.3 ),
"times": PoolRealArray( 0, 0.5 ),
"transitions": PoolRealArray( 1, 1 ),
"update": 0,
"values": [ Vector2( 0, 0 ), Vector2( -200, 0 ) ]
"values": [ Vector2( 0, 0 ), Vector2( -1000, 0 ) ]
}
[node name="Notice_msg" type="Node2D"]