доработка индикации

This commit is contained in:
2025-03-12 20:58:48 +03:00
parent ee7cd7a3c8
commit e9dddf4c2f
17 changed files with 1551 additions and 87 deletions

View File

@@ -435,7 +435,33 @@ func _ready() -> void:
func read_file():
var file = FileAccess.open("res://saves/fs_setting", FileAccess.READ)
if file.get_length() > 0:
FS_ATT = file.get_var()
file.close()
var file_path = "user://saves/fs_setting"
var dir_path = "user://saves"
# Проверяем и создаем папку, если она не существует
var dir = DirAccess.open(dir_path)
if not dir:
create_dir(dir_path)
var file = FileAccess.open(file_path, FileAccess.READ)
if file:
# Файл существует, читаем его содержимое
if file.get_length() > 0:
FS_ATT = file.get_var()
file.close()
else:
# Файл не существует, создаем его
create_file(file_path)
func create_dir(dir_path: String):
DirAccess.make_dir_absolute(dir_path)
func create_file(file_path: String):
var file = FileAccess.open(file_path, FileAccess.WRITE)
if file:
file.close()
print("Файл создан: ", file_path)
else:
print("Не удалось создать файл по пути:", file_path)