mirror of
https://github.com/Ttanasart-pt/Pixel-Composer.git
synced 2024-11-10 20:45:35 +01:00
Preset existance check
This commit is contained in:
parent
fc425113bf
commit
f1e1a7c906
@ -9,12 +9,15 @@
|
||||
directory_create(root);
|
||||
|
||||
var _l = root + "/version";
|
||||
if(file_exists(_l)) {
|
||||
var res = json_load_struct(_l);
|
||||
if(!is_struct(res) || !struct_has(res, "version") || res.version < VERSION)
|
||||
zip_unzip("data/Preset.zip", root);
|
||||
} else
|
||||
zip_unzip("data/Preset.zip", root);
|
||||
var _preset_path = "data/Preset.zip";
|
||||
if(file_exists(_preset_path)) {
|
||||
if(file_exists(_l)) {
|
||||
var res = json_load_struct(_l);
|
||||
if(!is_struct(res) || !struct_has(res, "version") || res.version < VERSION)
|
||||
zip_unzip(_preset_path, root);
|
||||
} else
|
||||
zip_unzip(_preset_path, root);
|
||||
}
|
||||
json_save_struct(_l, { version: VERSION });
|
||||
|
||||
global.PRESETS = new DirectoryObject("Presets", root);
|
||||
|
@ -10,7 +10,7 @@ function file_text_read_all(path) {
|
||||
function file_text_read_all_lines(path) {
|
||||
var f = file_text_open_read(path);
|
||||
var s = [];
|
||||
while(!file_text_eof(f))
|
||||
while(!file_text_eof(f))
|
||||
array_push(s, file_text_readln(f));
|
||||
file_text_close(f);
|
||||
return s;
|
||||
|
Loading…
Reference in New Issue
Block a user