Add true portable mode (#259)

This commit is contained in:
Jeod
2025-09-26 15:32:42 -04:00
committed by GitHub
parent 7b0a62c765
commit 659e9f3ce8
28 changed files with 176 additions and 96 deletions

View File

@@ -34,10 +34,9 @@ func save_level(level_name := "Unnamed Level", level_author := "You", level_desc
return level_file
func write_file(json := {}, lvl_file_name := "") -> void:
DirAccess.make_dir_absolute(LevelEditor.CUSTOM_LEVEL_DIR)
for i in "<>:?!/":
lvl_file_name = lvl_file_name.replace(i, "")
var file = FileAccess.open(LevelEditor.CUSTOM_LEVEL_DIR + lvl_file_name, FileAccess.WRITE)
var file = FileAccess.open(Global.config_path.path_join("custom_levels/" + lvl_file_name), FileAccess.WRITE)
file.store_string(JSON.stringify(json, "", false))
file.close()
print("saved")