44 lines
1.1 KiB
GDScript
44 lines
1.1 KiB
GDScript
extends Node
|
|
|
|
var base_path = "user://"
|
|
var data_path = "user://"
|
|
|
|
func _ready():
|
|
if OS.has_feature("release"):
|
|
base_path=OS.get_executable_path().path_join("data")
|
|
data_path=base_path+"data/"
|
|
|
|
func game_exists(game)->bool:
|
|
return DirAccess.dir_exists_absolute(base_path+game)
|
|
|
|
func game_config_exists(game)->bool:
|
|
if !game_exists(game):
|
|
return false
|
|
|
|
return DirAccess.dir_exists_absolute(base_path+game+"/config.cfg")
|
|
|
|
func create_game_folder(game):
|
|
DirAccess.make_dir_recursive_absolute(base_path+game+"/profiles")
|
|
|
|
var file := ConfigFile.new()
|
|
file.set_value("Data","game_name","Dummy")
|
|
file.set_value("Data","game_icon_path","icon.svg")
|
|
file.save(base_path+game+"/config.cfg")
|
|
|
|
func get_game_config(game)->ConfigFile:
|
|
var file := ConfigFile.new()
|
|
if !game_config_exists(game):
|
|
file.set_value("Data","game_name","Dummy")
|
|
file.set_value("Data","game_icon_path","icon.svg")
|
|
file.save(base_path+game+"/config.cfg")
|
|
return file
|
|
file.load(base_path+game+"/config.cfg")
|
|
return file
|
|
|
|
func game_script_exists(game)->bool:
|
|
if !game_exists(game):
|
|
return false
|
|
|
|
return DirAccess.dir_exists_absolute(base_path+game+"/game.lua")
|
|
|
|
|