@@ -294,7 +294,7 @@ func load_game_data_files():
294
294
if dir .current_is_dir () and \
295
295
((_systems_raw .has (file_name ) and not _systems_raw [file_name ].has ("#delete" )) or \
296
296
_system_renames .has (file_name )):
297
- load_system_gamelists_files (config .games_dir + "/" + file_name , file_name )
297
+ load_system_gamelists_files (config .games_dir . path_join ( file_name ) , file_name )
298
298
# We are not interested in files, only folders
299
299
file_name = dir .get_next ()
300
300
dir .list_dir_end ()
@@ -310,7 +310,7 @@ func load_system_gamelists_files(folder_path: String, system_name: String):
310
310
return
311
311
var file_name := dir .get_next ()
312
312
while file_name != "" :
313
- var full_path := folder_path + "/" + file_name
313
+ var full_path := folder_path . path_join ( file_name )
314
314
if dir .current_is_dir ():
315
315
# Recurse
316
316
# TODO: prevent infinite recursion with shortcuts/symlinks
@@ -350,10 +350,9 @@ func load_system_gamelists_files(folder_path: String, system_name: String):
350
350
dir .list_dir_end ()
351
351
352
352
func make_system_folder (system_raw : Dictionary ):
353
- var path : String = config .games_dir + "/" + system_raw ["name" ]
354
- var dir := DirAccess .open (path )
355
- if dir and not dir .dir_exists (path ):
356
- if dir .make_dir_recursive (path ):
353
+ var path : String = config .games_dir .path_join (system_raw ["name" ])
354
+ if not DirAccess .dir_exists_absolute (path ):
355
+ if DirAccess .make_dir_recursive_absolute (path ):
357
356
push_error ("Failed to create system folder " + path )
358
357
359
358
func fetch_game_data (path : String , game : RetroHubGameData ) -> bool :
@@ -378,7 +377,7 @@ func fetch_game_data(path: String, game: RetroHubGameData) -> bool:
378
377
return true
379
378
380
379
func get_game_data_path_from_file (system_name : String , file_name : String ) -> String :
381
- return get_gamelists_dir () + "/" + system_name + "/" + file_name .get_file ().trim_suffix (file_name .get_extension ()) + "json"
380
+ return get_gamelists_dir (). path_join ( system_name ). path_join ( file_name .get_file ().trim_suffix (file_name .get_extension ()) + "json" )
382
381
383
382
func save_game_data (game_data : RetroHubGameData ) -> bool :
384
383
var metadata_path := get_game_data_path_from_file (game_data .system .name , game_data .path )
@@ -424,9 +423,9 @@ func is_file_from_system(file_name: String, system_name: String) -> bool:
424
423
func load_theme () -> bool :
425
424
var current_theme := config .current_theme
426
425
if current_theme .ends_with (".pck" ):
427
- theme_path = get_themes_dir () + "/" + current_theme
426
+ theme_path = get_themes_dir (). path_join ( current_theme )
428
427
else :
429
- theme_path = get_default_themes_dir () + "/" + current_theme + ".pck"
428
+ theme_path = get_default_themes_dir (). path_join ( current_theme + ".pck" )
430
429
# FIXME: Theme hot-reloading is disabled until nasty GDScript bug is solved
431
430
if not ProjectSettings .is_pack_loaded (theme_path ):
432
431
if not ProjectSettings .load_resource_pack (theme_path , false ):
0 commit comments