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, # When everything is loaded,
func _ready(): func _ready():
# Determine the os_name # Determine the os_name
if OS.get_name() == "X11": # X11 is linuxy-based if OS.get_name() == "X11": # X11 is linuxy-based
os_name = "linux" os_name = "linux"
@ -144,6 +143,8 @@ func _on_Play_button_pressed():
# If not, # If not,
# Play the game # Play the game
else: else:
# 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 # Attempt to execute the UltraFlare executable
var exit_code = OS.execute(OS.get_config_dir()+"/UltraFlare/current/UltraFlare-"+os_name+"-x86_64"+suffix, [], false) var exit_code = OS.execute(OS.get_config_dir()+"/UltraFlare/current/UltraFlare-"+os_name+"-x86_64"+suffix, [], false)
@ -154,3 +155,7 @@ func _on_Play_button_pressed():
# If not, print out a debug message with the exit code # If not, print out a debug message with the exit code
else: else:
print("Running UltraFlare failed with code: "+exit_code) print("Running UltraFlare failed with code: "+exit_code)
# If not,
else:
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] [ext_resource path="res://Notice_msg.gd" type="Script" id=2]
[sub_resource type="DynamicFont" id=1] [sub_resource type="DynamicFont" id=1]
size = 24
extra_spacing_char = 4 extra_spacing_char = 4
font_data = ExtResource( 1 ) font_data = ExtResource( 1 )
@ -37,7 +36,7 @@ tracks/1/keys = {
[sub_resource type="Animation" id=3] [sub_resource type="Animation" id=3]
resource_name = "move_off_screen" resource_name = "move_off_screen"
length = 0.3 length = 0.5
tracks/0/type = "value" tracks/0/type = "value"
tracks/0/path = NodePath("Label:rect_position") tracks/0/path = NodePath("Label:rect_position")
tracks/0/interp = 1 tracks/0/interp = 1
@ -45,10 +44,10 @@ tracks/0/loop_wrap = true
tracks/0/imported = false tracks/0/imported = false
tracks/0/enabled = true tracks/0/enabled = true
tracks/0/keys = { tracks/0/keys = {
"times": PoolRealArray( 0, 0.3 ), "times": PoolRealArray( 0, 0.5 ),
"transitions": PoolRealArray( 1, 1 ), "transitions": PoolRealArray( 1, 1 ),
"update": 0, "update": 0,
"values": [ Vector2( 0, 0 ), Vector2( -200, 0 ) ] "values": [ Vector2( 0, 0 ), Vector2( -1000, 0 ) ]
} }
[node name="Notice_msg" type="Node2D"] [node name="Notice_msg" type="Node2D"]