diff --git a/objects/_addon_custom/Create_0.gml b/objects/_addon_custom/Create_0.gml index b60830516..59aa1dcf1 100644 --- a/objects/_addon_custom/Create_0.gml +++ b/objects/_addon_custom/Create_0.gml @@ -19,7 +19,7 @@ event_inherited(); context_menus = {}; panels = {}; - if(file_exists(propPath)) { + if(file_exists_empty(propPath)) { var meta = json_load_struct(propPath); if(struct_has(meta, "panels")) { panels = meta.panels; @@ -52,7 +52,7 @@ event_inherited(); } scriptPath = directory + "\\script.lua"; - if(!file_exists(scriptPath)) { + if(!file_exists_empty(scriptPath)) { noti_warning(title + " Addon error: script.lua not found."); return self; } diff --git a/objects/o_crash_handler/Create_0.gml b/objects/o_crash_handler/Create_0.gml index 9d6c523b6..b81cbc5b3 100644 --- a/objects/o_crash_handler/Create_0.gml +++ b/objects/o_crash_handler/Create_0.gml @@ -24,7 +24,7 @@ } var perstPath = APP_DIRECTORY + "persistPreference.json"; - if(file_exists(perstPath)) { + if(file_exists_empty(perstPath)) { PRESIST_PREF = json_load_struct(perstPath); DIRECTORY = struct_has(PRESIST_PREF, "path")? PRESIST_PREF.path : ""; } @@ -35,7 +35,7 @@ #region log path = DIRECTORY + "log/crash_log.txt"; - if(!file_exists(path)) game_end(1); + if(!file_exists_empty(path)) game_end(1); crash_content = file_read_all(path); log_surface = surface_create(1, 1); diff --git a/objects/o_dialog_crashed/Draw_64.gml b/objects/o_dialog_crashed/Draw_64.gml index 97f39dbc8..7d8333fa1 100644 --- a/objects/o_dialog_crashed/Draw_64.gml +++ b/objects/o_dialog_crashed/Draw_64.gml @@ -46,6 +46,6 @@ draw_set_alpha(1); draw_text(bx0 + bw / 2, by0 + bh / 2, __txtx("crashed_log", "Log file") + "..."); if(b == 2) { var path = string(DIRECTORY) + "crash_log.txt"; - if(file_exists(path)) shellOpenExplorer(path); + if(file_exists_empty(path)) shellOpenExplorer(path); } #endregion \ No newline at end of file diff --git a/objects/o_dialog_file_name_collection/Draw_64.gml b/objects/o_dialog_file_name_collection/Draw_64.gml index 1bd99ee4b..dc80b5799 100644 --- a/objects/o_dialog_file_name_collection/Draw_64.gml +++ b/objects/o_dialog_file_name_collection/Draw_64.gml @@ -70,7 +70,7 @@ if(_newPath != updating.path) { file_rename(updating.path, _newPath); file_rename(updating.meta_path, _newMeta); - if(file_exists(_oldSpr)) file_rename(_oldSpr, _newSpr); + if(file_exists_empty(_oldSpr)) file_rename(_oldSpr, _newSpr); } updating.path = _newPath; diff --git a/objects/o_dialog_preference/Create_0.gml b/objects/o_dialog_preference/Create_0.gml index e728e1ec9..a75cb0447 100644 --- a/objects/o_dialog_preference/Create_0.gml +++ b/objects/o_dialog_preference/Create_0.gml @@ -482,7 +482,7 @@ event_inherited(); var _path = $"{DIRECTORY}themes/{f}"; if(directory_exists(_path)) { var _metaPath = _path + "/meta.json"; - if(!file_exists(_metaPath)) { + if(!file_exists_empty(_metaPath)) { var _item = new scrollItem(f, THEME.circle); _item.spr_blend = COLORS._main_accent; _item.tooltip = "Theme made for earlier version."; diff --git a/objects/o_dialog_preference/Draw_64.gml b/objects/o_dialog_preference/Draw_64.gml index b371f00b6..dd82aff90 100644 --- a/objects/o_dialog_preference/Draw_64.gml +++ b/objects/o_dialog_preference/Draw_64.gml @@ -56,7 +56,7 @@ if !ready exit; var b = buttonInstant(THEME.button_hide, bx, py, ui(32), ui(32), mouse_ui, sFOCUS, sHOVER, _txt, THEME.refresh); if(b == 2) { var path = $"{DIRECTORY}themes/{PREFERENCES.theme}/override.json"; - if(file_exists(path)) file_delete(path); + if(file_exists_empty(path)) file_delete(path); loadColor(PREFERENCES.theme); } diff --git a/objects/o_dialog_splash/Create_0.gml b/objects/o_dialog_splash/Create_0.gml index 6c5726727..a7c5b8050 100644 --- a/objects/o_dialog_splash/Create_0.gml +++ b/objects/o_dialog_splash/Create_0.gml @@ -64,7 +64,7 @@ event_inherited(); var _rec = RECENT_FILES[| ind]; var _dat = RECENT_FILE_DATA[| ind]; - if(!file_exists(_rec)) continue; + if(!file_exists_empty(_rec)) continue; var thmb = recent_thumbnail? _dat.getThumbnail() : noone; var fx = j * (ww + ui(8)); diff --git a/objects/o_dialog_splash/Other_62.gml b/objects/o_dialog_splash/Other_62.gml index 5ade44e7d..c7c2d033d 100644 --- a/objects/o_dialog_splash/Other_62.gml +++ b/objects/o_dialog_splash/Other_62.gml @@ -112,7 +112,7 @@ for( var i = 0, n = array_length(keys); i < n; i++ ) { var path = att[1]; - if(!file_exists(path)) { + if(!file_exists_empty(path)) { attachment[? keys[i]] = noone; exit; } diff --git a/objects/o_main/Alarm_1.gml b/objects/o_main/Alarm_1.gml index 9bb9a2cca..48085def5 100644 --- a/objects/o_main/Alarm_1.gml +++ b/objects/o_main/Alarm_1.gml @@ -2,6 +2,6 @@ #region prefload __migration_check(); - if(!file_exists(file_open_parameter) && PREFERENCES.show_splash) + if(!file_exists_empty(file_open_parameter) && PREFERENCES.show_splash) dialogCall(o_dialog_splash); #endregion \ No newline at end of file diff --git a/objects/o_main/Other_2.gml b/objects/o_main/Other_2.gml index 65fa6242f..18e2ab2ee 100644 --- a/objects/o_main/Other_2.gml +++ b/objects/o_main/Other_2.gml @@ -20,7 +20,7 @@ directory_verify(APP_DIRECTORY); var perstPath = APP_DIRECTORY + "persistPreference.json"; - if(file_exists(perstPath)) { + if(file_exists_empty(perstPath)) { PRESIST_PREF = json_load_struct(perstPath); DIRECTORY = struct_has(PRESIST_PREF, "path")? PRESIST_PREF.path : ""; } @@ -100,7 +100,7 @@ __initPanel(); - if(file_exists("icon.png")) + if(file_exists_empty("icon.png")) file_copy("icon.png", DIRECTORY + "icon.png"); environment_set_variable("IMGUI_DIALOG_WIDTH", string(800)); @@ -126,7 +126,7 @@ path = string_replace_all(path, "\n", ""); path = string_replace_all(path, "\"", ""); - if(file_exists(path) && filename_ext(path) == ".pxc") { + if(file_exists_empty(path) && filename_ext(path) == ".pxc") { file_open_parameter = path; alarm[2] = 3; } diff --git a/scripts/__initAddon/__initAddon.gml b/scripts/__initAddon/__initAddon.gml index 3da9ffcf1..2a5ffa713 100644 --- a/scripts/__initAddon/__initAddon.gml +++ b/scripts/__initAddon/__initAddon.gml @@ -22,7 +22,7 @@ function __initAddon() { var _path = dirPath + "\\" + f; var _meta = _path + "\\meta.json"; - if(!file_exists(_meta)) { + if(!file_exists_empty(_meta)) { f = file_find_next(); continue; } @@ -45,7 +45,7 @@ function __initAddon() { function loadAddon() { var _path = DIRECTORY + "Addons\\__init.json"; - if(!file_exists(_path)) return; + if(!file_exists_empty(_path)) return; ADDONS_ON_START = json_load_struct(_path); for( var i = 0, n = array_length(ADDONS_ON_START); i < n; i++ ) diff --git a/scripts/__node_3d_obj/__node_3d_obj.gml b/scripts/__node_3d_obj/__node_3d_obj.gml index 459a4f843..0b99ae796 100644 --- a/scripts/__node_3d_obj/__node_3d_obj.gml +++ b/scripts/__node_3d_obj/__node_3d_obj.gml @@ -122,7 +122,7 @@ function __Node_3D_Obj(_x, _y, _group = noone) : Node(_x, _y, _group) constructo var matY = y - (array_length(materials) - 1) / 2 * (128 + 32); var mat = materials[m_index]; - if(file_exists(mat.diff_path)) { + if(file_exists_empty(mat.diff_path)) { var sol = Node_create_Image_path(x - (w + 64), matY + m_index * (128 + 32), mat.diff_path); sol.name = mat.name + " texture"; @@ -138,7 +138,7 @@ function __Node_3D_Obj(_x, _y, _group = noone) : Node(_x, _y, _group) constructo static updateObj = function(updateMat = true) { var _path = getInputData(0); - if(!file_exists(_path)) return; + if(!file_exists_empty(_path)) return; var _flip = getInputData(12); var _dir = filename_dir(_path); diff --git a/scripts/__node_3d_render/__node_3d_render.gml b/scripts/__node_3d_render/__node_3d_render.gml index 3157fcfb2..378aedb6a 100644 --- a/scripts/__node_3d_render/__node_3d_render.gml +++ b/scripts/__node_3d_render/__node_3d_render.gml @@ -96,7 +96,7 @@ // var matY = y - (array_length(materials) - 1) / 2 * (128 + 32); // var mat = materials[m_index]; -// if(file_exists(mat.diff_path)) { +// if(file_exists_empty(mat.diff_path)) { // var sol = Node_create_Image_path(x - (w + 64), matY + m_index * (128 + 32), mat.diff_path); // sol.name = mat.name + " texture"; diff --git a/scripts/__node_custom/__node_custom.gml b/scripts/__node_custom/__node_custom.gml index ae4bddd0a..e2b6c1606 100644 --- a/scripts/__node_custom/__node_custom.gml +++ b/scripts/__node_custom/__node_custom.gml @@ -7,7 +7,7 @@ function Node_create_Custom(_x, _y, _group = noone, _param = {}) { } function Node_create_Custom_path(_x, _y, path) { - if(!file_exists(path)) return noone; + if(!file_exists_empty(path)) return noone; var node = new Node_Custom(_x, _y, PANEL_GRAPH.getCurrentContext()); if(!node.setPath(path)) return noone; @@ -31,7 +31,7 @@ function Node_Custom(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) co static setPath = function(_path) { var _info = _path + "/info.json"; - if(!file_exists(_info)) return false; + if(!file_exists_empty(_info)) return false; info = json_load_struct(_info); path = _path; @@ -191,7 +191,7 @@ function __initNodeCustom(list) { #region _n.tooltip = _info.tooltip; var _tol = _dir + _info.tooltip_spr; - if(file_exists(_tol)) _n.tooltip_spr = sprite_add(_tol, 0, false, false, 0, 0); + if(file_exists_empty(_tol)) _n.tooltip_spr = sprite_add(_tol, 0, false, false, 0, 0); ds_list_add(list, _n); diff --git a/scripts/addon_lua_function/addon_lua_function.gml b/scripts/addon_lua_function/addon_lua_function.gml index f423442da..51943532f 100644 --- a/scripts/addon_lua_function/addon_lua_function.gml +++ b/scripts/addon_lua_function/addon_lua_function.gml @@ -641,7 +641,7 @@ [ "rectangle_in_circle", rectangle_in_circle ], //file - [ "file_exists", file_exists ], + [ "file_exists_empty", file_exists_empty ], [ "file_delete", file_delete ], [ "file_rename", file_rename ], [ "file_copy", file_copy ], diff --git a/scripts/buffer_functions/buffer_functions.gml b/scripts/buffer_functions/buffer_functions.gml index 1af1656dd..8e2bfc840 100644 --- a/scripts/buffer_functions/buffer_functions.gml +++ b/scripts/buffer_functions/buffer_functions.gml @@ -46,7 +46,7 @@ function buffer_from_surface(surface, header = true) { } function buffer_from_file(path) { - if(!file_exists(path)) return; + if(!file_exists_empty(path)) return; var _b = buffer_load(path); return _b; } diff --git a/scripts/color_loader/color_loader.gml b/scripts/color_loader/color_loader.gml index eb660d9df..24041199d 100644 --- a/scripts/color_loader/color_loader.gml +++ b/scripts/color_loader/color_loader.gml @@ -16,17 +16,17 @@ function loadColor(theme = "default") { } function _loadColor(theme = "default", replace = false) { - var dirr = DIRECTORY + "themes/" + theme; + var dirr = DIRECTORY + "Themes/" + theme; var path = dirr + "/values.json"; var pathO = dirr + "/override.json"; - if(!file_exists(path)) { + if(!file_exists_empty(path)) { noti_status("Colors not defined at " + path + ", rollback to default color."); return; } var clrs = json_load_struct(path); - var oclr = file_exists(pathO)? json_load_struct(pathO) : {}; + var oclr = file_exists_empty(pathO)? json_load_struct(pathO) : {}; if(!struct_has(clrs, "values")) { print("Load color error"); diff --git a/scripts/debug/debug.gml b/scripts/debug/debug.gml index 35add112a..73e7a59ee 100644 --- a/scripts/debug/debug.gml +++ b/scripts/debug/debug.gml @@ -54,7 +54,7 @@ function log_newline() { function log_clear() { var path = DIRECTORY + "log/log.txt"; - if(file_exists(path)) + if(file_exists_empty(path)) file_delete(path); } diff --git a/scripts/directory_object/directory_object.gml b/scripts/directory_object/directory_object.gml index b197b11d6..1d23fc157 100644 --- a/scripts/directory_object/directory_object.gml +++ b/scripts/directory_object/directory_object.gml @@ -95,11 +95,11 @@ function FileObject(_name, _path) constructor { #region if(meta != noone) return meta; if(meta == undefined) return noone; - if(!file_exists(path)) return noone; + if(!file_exists_empty(path)) return noone; meta = new MetaDataManager(); - if(file_exists(meta_path)) { + if(file_exists_empty(meta_path)) { meta.deserialize(json_load_struct(meta_path)); } else { var m = json_load_struct(path); @@ -170,7 +170,7 @@ function DirectoryObject(name, path) constructor { #region f.spr_path = [icon_path, amo, false]; } else { var icon_path = path + "/" + filename_change_ext(file, ".png"); - if(!file_exists(icon_path)) continue; + if(!file_exists_empty(icon_path)) continue; var _temp = sprite_add(icon_path, 0, false, false, 0, 0); var ww = sprite_get_width(_temp); diff --git a/scripts/export_portable/export_portable.gml b/scripts/export_portable/export_portable.gml index 157cd2e7f..56d0df663 100644 --- a/scripts/export_portable/export_portable.gml +++ b/scripts/export_portable/export_portable.gml @@ -28,11 +28,11 @@ function exportPortable(project = PROJECT) { for( var k = 0, o = array_length(_input.raw_value); k < o; k++ ) { var _val = _input.raw_value[k][1]; - if(is_string(_val) && file_exists(_val)) + if(is_string(_val) && file_exists_empty(_val)) _input.raw_value[k][1] = __pack_file_strip(zip, _val); else if(is_array(_val)) { for( var l = 0, p = array_length(_val); l < p; l++ ) { - if(is_string(_val[l]) && file_exists(_val[l])) + if(is_string(_val[l]) && file_exists_empty(_val[l])) _input.raw_value[k][1][l] = __pack_file_strip(zip, _val[l]); } } diff --git a/scripts/file_functions/file_functions.gml b/scripts/file_functions/file_functions.gml index 0f8de3493..20d73a2b2 100644 --- a/scripts/file_functions/file_functions.gml +++ b/scripts/file_functions/file_functions.gml @@ -1,5 +1,7 @@ +function file_exists_empty(path) { INLINE return path != "" && file_exists(path); } + function file_copy_override(src, dest) { - if(file_exists(dest)) file_delete(dest); + if(file_exists_empty(dest)) file_delete(dest); file_copy(src, dest); } diff --git a/scripts/font_loader/font_loader.gml b/scripts/font_loader/font_loader.gml index f1baa9b7e..cc2966e6e 100644 --- a/scripts/font_loader/font_loader.gml +++ b/scripts/font_loader/font_loader.gml @@ -43,14 +43,13 @@ function _font_extend_locale(baseFont, localFont, override = false) { #region function _font_path(rel) { #region rel = string_replace_all(rel, "./", ""); - - var defPath = $"{DIRECTORY}themes/{PREFERENCES.theme}/fonts/{rel}"; + var defPath = $"{DIRECTORY}Themes/{PREFERENCES.theme}/fonts/{rel}"; if(LOCALE.fontDir == noone) return defPath; var overridePath = $"{LOCALE.fontDir}{rel}"; - if(file_exists(overridePath)) + if(file_exists_empty(overridePath)) return overridePath; return defPath; @@ -62,13 +61,14 @@ function _font_load_from_struct(str, name, def, over = true) { #region var font = str[$ name]; var path = ""; - if(over && file_exists(PREFERENCES.font_overwrite)) path = PREFERENCES.font_overwrite; - else { + if(over && file_exists_empty(PREFERENCES.font_overwrite)) + path = PREFERENCES.font_overwrite; + else path = _font_path(font.path); - if(!file_exists(path)) { - noti_status($"Font resource {path} not found. Rollback to default font."); - return def; - } + + if(!file_exists_empty(path)) { + noti_status($"Font resource {path} not found. Rollback to default font."); + return def; } font_add_enable_aa(THEME_VALUE.font_aa); @@ -101,7 +101,7 @@ function loadFonts() { #region var path = _font_path("./fonts.json"); - if(!file_exists(path)) { + if(!file_exists_empty(path)) { noti_status("Font not defined at " + path + ", rollback to default fonts."); f_h1 = _f_h1; f_h2 = _f_h2; diff --git a/scripts/gradients_function/gradients_function.gml b/scripts/gradients_function/gradients_function.gml index d7bc55b05..0d413864e 100644 --- a/scripts/gradients_function/gradients_function.gml +++ b/scripts/gradients_function/gradients_function.gml @@ -213,7 +213,7 @@ function gradientObject(color = c_black) constructor { #region function loadGradient(path) { #region if(path == "") return noone; - if(!file_exists(path)) return noone; + if(!file_exists_empty(path)) return noone; var grad = new gradientObject(); grad.keys = []; diff --git a/scripts/json_file/json_file.gml b/scripts/json_file/json_file.gml index 35cec3729..707cdefff 100644 --- a/scripts/json_file/json_file.gml +++ b/scripts/json_file/json_file.gml @@ -13,7 +13,7 @@ function json_stringify_minify(map) { function json_load(path) { gml_pragma("forceinline"); - if(!file_exists(path)) return noone; + if(!file_exists_empty(path)) return noone; var s = file_read_all(path); var js = json_decode(s); @@ -33,7 +33,7 @@ function json_save(path, map) { function json_load_struct(path) { gml_pragma("forceinline"); - if(!file_exists(path)) return noone; + if(!file_exists_empty(path)) return noone; var s = file_read_all(path); var js = json_try_parse(s); diff --git a/scripts/load_function/load_function.gml b/scripts/load_function/load_function.gml index 92c20d1b0..83126d229 100644 --- a/scripts/load_function/load_function.gml +++ b/scripts/load_function/load_function.gml @@ -52,7 +52,7 @@ function LOAD_PATH(path, readonly = false, safe_mode = false) { #region function __LOAD_PATH(path, readonly = false, override = false) { #region if(DEMO) return false; - if(!file_exists(path)) { + if(!file_exists_empty(path)) { log_warning("LOAD", "File not found"); return false; } @@ -77,7 +77,7 @@ function __LOAD_PATH(path, readonly = false, override = false) { #region directory_verify(temp_path); var temp_file_path = TEMPDIR + string(UUID_generate(6)); - if(file_exists(temp_file_path)) file_delete(temp_file_path); + if(file_exists_empty(temp_file_path)) file_delete(temp_file_path); file_copy(path, temp_file_path); PROJECT.readonly = readonly; @@ -267,7 +267,7 @@ function __IMPORT_ZIP() { #region var _f = file_find_first(_dir + "/*.pxc", fa_none); var _proj = $"{_dir}/{_f}"; print(_proj); - if(!file_exists(_proj)) return false; + if(!file_exists_empty(_proj)) return false; LOAD_PATH(_proj, true); } #endregion \ No newline at end of file diff --git a/scripts/locale_data/locale_data.gml b/scripts/locale_data/locale_data.gml index 6da775911..880a089ea 100644 --- a/scripts/locale_data/locale_data.gml +++ b/scripts/locale_data/locale_data.gml @@ -17,7 +17,7 @@ function __locale_file(file) { #region var dirr = $"{DIRECTORY}Locale/{PREFERENCES.local}"; - if(!directory_exists(dirr) || !file_exists(dirr + file)) + if(!directory_exists(dirr) || !file_exists_empty(dirr + file)) dirr = $"{DIRECTORY}Locale/en"; return dirr + file; } #endregion diff --git a/scripts/meta_data/meta_data.gml b/scripts/meta_data/meta_data.gml index c5e5e27ae..6978d47b8 100644 --- a/scripts/meta_data/meta_data.gml +++ b/scripts/meta_data/meta_data.gml @@ -233,7 +233,7 @@ function MetaDataManager() constructor { var meta = new MetaDataManager(); var path = DIRECTORY + "meta.json"; - if(!file_exists(path)) return meta; + if(!file_exists_empty(path)) return meta; var over = json_load_struct(path); return meta.deserialize(over); } diff --git a/scripts/migration_function/migration_function.gml b/scripts/migration_function/migration_function.gml index 938f556a8..5e7c14f8d 100644 --- a/scripts/migration_function/migration_function.gml +++ b/scripts/migration_function/migration_function.gml @@ -3,7 +3,7 @@ function __migration_check() { if(!directory_exists(oldDir)) return; var mig = oldDir + "migration"; - if(file_exists(mig)) return; + if(file_exists_empty(mig)) return; var f = file_text_open_write(mig); file_text_close(f); diff --git a/scripts/mtl_reader/mtl_reader.gml b/scripts/mtl_reader/mtl_reader.gml index 1968ff690..f20189a84 100644 --- a/scripts/mtl_reader/mtl_reader.gml +++ b/scripts/mtl_reader/mtl_reader.gml @@ -17,7 +17,7 @@ function str_strip_nr(str) { } function readMtl(path) { - if(!file_exists(path)) return []; + if(!file_exists_empty(path)) return []; var mat = []; var cur_mat = noone; diff --git a/scripts/node_3d_mesh_obj/node_3d_mesh_obj.gml b/scripts/node_3d_mesh_obj/node_3d_mesh_obj.gml index e64d5faa5..a30b6707a 100644 --- a/scripts/node_3d_mesh_obj/node_3d_mesh_obj.gml +++ b/scripts/node_3d_mesh_obj/node_3d_mesh_obj.gml @@ -12,7 +12,7 @@ function Node_create_3D_Obj(_x, _y, _group = noone) { #region } #endregion function Node_create_3D_Obj_path(_x, _y, path) { #region - if(!file_exists(path)) return noone; + if(!file_exists_empty(path)) return noone; var node = new Node_3D_Mesh_Obj(_x, _y, PANEL_GRAPH.getCurrentContext()); node.setPath(path); @@ -82,7 +82,7 @@ function Node_3D_Mesh_Obj(_x, _y, _group = noone) : Node_3D_Mesh(_x, _y, _group) var mat = materials[m_index]; inputs[| index].name = materialNames[m_index] + " Material"; - if(file_exists(mat.diff_path)) { + if(file_exists_empty(mat.diff_path)) { var sol = Node_create_Image_path(x - (w + 128), matY + m_index * (128 + 32), mat.diff_path); sol.name = mat.name + " texture"; @@ -97,7 +97,7 @@ function Node_3D_Mesh_Obj(_x, _y, _group = noone) : Node_3D_Mesh(_x, _y, _group) } #endregion static updateObj = function(_path) { #region - if(!file_exists(_path)) return; + if(!file_exists_empty(_path)) return; current_path = _path; readObj_init(); diff --git a/scripts/node_action_object/node_action_object.gml b/scripts/node_action_object/node_action_object.gml index 79d177b52..279fb324a 100644 --- a/scripts/node_action_object/node_action_object.gml +++ b/scripts/node_action_object/node_action_object.gml @@ -88,7 +88,7 @@ if(struct_has(map, "sprPath")) { var _path = string_replace(map.sprPath, "./", filename_dir(path) + "/"); - if(file_exists(_path)) { + if(file_exists_empty(_path)) { spr = sprite_add(_path, 1, false, false, 0, 0); sprite_set_offset(spr, sprite_get_width(spr) / 2, sprite_get_height(spr) / 2); } diff --git a/scripts/node_ase_file_read/node_ase_file_read.gml b/scripts/node_ase_file_read/node_ase_file_read.gml index f9f8ce9ee..341216705 100644 --- a/scripts/node_ase_file_read/node_ase_file_read.gml +++ b/scripts/node_ase_file_read/node_ase_file_read.gml @@ -14,7 +14,7 @@ function Node_create_ASE_File_Read(_x, _y, _group = noone) { #region } #endregion function Node_create_ASE_File_Read_path(_x, _y, path) { #region - if(!file_exists(path)) return noone; + if(!file_exists_empty(path)) return noone; var node = new Node_ASE_File_Read(_x, _y, PANEL_GRAPH.getCurrentContext()); node.inputs[| 0].setValue(path); diff --git a/scripts/node_csv_file_read/node_csv_file_read.gml b/scripts/node_csv_file_read/node_csv_file_read.gml index 3cd27f6aa..77db6f56e 100644 --- a/scripts/node_csv_file_read/node_csv_file_read.gml +++ b/scripts/node_csv_file_read/node_csv_file_read.gml @@ -14,7 +14,7 @@ function Node_create_CSV_File_Read(_x, _y, _group = noone) { #region } #endregion function Node_create_CSV_File_Read_path(_x, _y, path) { #region - if(!file_exists(path)) return noone; + if(!file_exists_empty(path)) return noone; var node = new Node_CSV_File_Read(_x, _y, PANEL_GRAPH.getCurrentContext()); node.inputs[| 0].setValue(path); diff --git a/scripts/node_display_image/node_display_image.gml b/scripts/node_display_image/node_display_image.gml index fab349fd5..5f05a34a6 100644 --- a/scripts/node_display_image/node_display_image.gml +++ b/scripts/node_display_image/node_display_image.gml @@ -13,7 +13,7 @@ function Node_create_Display_Image(_x, _y, _group = noone) { #region } #endregion function Node_create_Display_Image_path(_x, _y, path) { #region - if(!file_exists(path)) return noone; + if(!file_exists_empty(path)) return noone; var node = new Node_Display_Image(_x, _y, PANEL_GRAPH.getCurrentContext()); node.inputs[| 0].setValue(path); diff --git a/scripts/node_export/node_export.gml b/scripts/node_export/node_export.gml index 161015dff..11cc1f293 100644 --- a/scripts/node_export/node_export.gml +++ b/scripts/node_export/node_export.gml @@ -218,10 +218,10 @@ function Node_Export(_x, _y, _group = noone) : Node(_x, _y, _group) constructor gifski = filepath_resolve(PREFERENCES.gifski_path) + "win/gifski.exe"; ffmpeg = filepath_resolve(PREFERENCES.ffmpeg_path) + "bin/ffmpeg.exe"; - if(!file_exists(converter) || !file_exists(magick)) noti_warning($"No ImageMagick detected at {magick}, please make sure the installation is complete and ImageMagick path is set properly in preference."); - if(!file_exists(webp)) noti_warning($"No webp detected at {webp}, please make sure the installation is complete and webp path is set properly in preference."); - if(!file_exists(gifski)) noti_warning($"No gifski detected at {gifski}, please make sure the installation is complete and gifski path is set properly in preference."); - if(!file_exists(ffmpeg)) noti_warning($"No ffmpeg detected at {ffmpeg}, please make sure the installation is complete and ffmpeg path is set properly in preference."); + if(!file_exists_empty(converter) || !file_exists_empty(magick)) noti_warning($"No ImageMagick detected at {magick}, please make sure the installation is complete and ImageMagick path is set properly in preference."); + if(!file_exists_empty(webp)) noti_warning($"No webp detected at {webp}, please make sure the installation is complete and webp path is set properly in preference."); + if(!file_exists_empty(gifski)) noti_warning($"No gifski detected at {gifski}, please make sure the installation is complete and gifski path is set properly in preference."); + if(!file_exists_empty(ffmpeg)) noti_warning($"No ffmpeg detected at {ffmpeg}, please make sure the installation is complete and ffmpeg path is set properly in preference."); static onValueUpdate = function(_index) { #region var form = getInputData(3); @@ -353,7 +353,7 @@ function Node_Export(_x, _y, _group = noone) : Node(_x, _y, _group) constructor var rate = getInputData( 8); if(rate == 0) rate = 1; - if(file_exists(target_path)) file_delete(target_path); + if(file_exists_empty(target_path)) file_delete(target_path); temp_path = string_replace_all(temp_path, "/", "\\"); target_path = string_replace_all(target_path, "/", "\\"); diff --git a/scripts/node_guide/node_guide.gml b/scripts/node_guide/node_guide.gml index b01ecc7cb..a3bcec0a4 100644 --- a/scripts/node_guide/node_guide.gml +++ b/scripts/node_guide/node_guide.gml @@ -149,10 +149,10 @@ function __initNodeData() { var nodeDir = DIRECTORY + "Nodes/"; - if(file_exists("data/tooltip.zip")) + if(file_exists_empty("data/tooltip.zip")) zip_unzip("data/tooltip.zip", nodeDir); - if(file_exists("data/nodes.json")) { + if(file_exists_empty("data/nodes.json")) { file_delete(nodeDir + "nodes.json"); file_copy_override("data/nodes.json", nodeDir + "nodes.json"); } @@ -162,7 +162,7 @@ function __initNodeData() { directory_verify(nodeDir + "Related"); file_copy_override(_relFrom, _relTo); - //print($"Copying related nodes from {_relFrom} to {_relTo}\n\t{file_exists(_relFrom)}, {file_exists(_relTo)}"); + //print($"Copying related nodes from {_relFrom} to {_relTo}\n\t{file_exists_empty(_relFrom)}, {file_exists_empty(_relTo)}"); __initNodeReleated(); } \ No newline at end of file diff --git a/scripts/node_image/node_image.gml b/scripts/node_image/node_image.gml index 3ff7dff13..6d187ee86 100644 --- a/scripts/node_image/node_image.gml +++ b/scripts/node_image/node_image.gml @@ -13,7 +13,7 @@ function Node_create_Image(_x, _y, _group = noone) { } function Node_create_Image_path(_x, _y, path) { - if(!file_exists(path)) return noone; + if(!file_exists_empty(path)) return noone; var node = new Node_Image(_x, _y, PANEL_GRAPH.getCurrentContext()); node.inputs[| 0].setValue(path); diff --git a/scripts/node_image_gif/node_image_gif.gml b/scripts/node_image_gif/node_image_gif.gml index f1c6a9d47..183a0464e 100644 --- a/scripts/node_image_gif/node_image_gif.gml +++ b/scripts/node_image_gif/node_image_gif.gml @@ -14,7 +14,7 @@ function Node_create_Image_gif(_x, _y, _group = noone) { #region } #endregion function Node_create_Image_gif_path(_x, _y, path) { #region - if(!file_exists(path)) return noone; + if(!file_exists_empty(path)) return noone; var node = new Node_Image_gif(_x, _y, PANEL_GRAPH.getCurrentContext()); node.inputs[| 0].setValue(path); diff --git a/scripts/node_json_file_read/node_json_file_read.gml b/scripts/node_json_file_read/node_json_file_read.gml index e4a67091b..abf2b822d 100644 --- a/scripts/node_json_file_read/node_json_file_read.gml +++ b/scripts/node_json_file_read/node_json_file_read.gml @@ -14,7 +14,7 @@ function Node_create_Json_File_Read(_x, _y, _group = noone) { } function Node_create_Json_File_Read_path(_x, _y, path) { - if(!file_exists(path)) return noone; + if(!file_exists_empty(path)) return noone; var node = new Node_Json_File_Read(_x, _y, PANEL_GRAPH.getCurrentContext()); node.inputs[| 0].setValue(path); diff --git a/scripts/node_registry/node_registry.gml b/scripts/node_registry/node_registry.gml index 8bba2a2c4..03b155d1d 100644 --- a/scripts/node_registry/node_registry.gml +++ b/scripts/node_registry/node_registry.gml @@ -14,7 +14,7 @@ function NodeObject(_name, _spr, _node, _create, tags = []) constructor { #regio is_patreon_extra = false; var pth = DIRECTORY + "Nodes/tooltip/" + node + ".png"; - if(file_exists(pth)) + if(file_exists_empty(pth)) tooltip_spr = sprite_add(pth, 0, false, false, 0, 0); new_node = false; @@ -228,11 +228,11 @@ function __initNodes() { global.__currPage = ""; var favPath = DIRECTORY + "Nodes/fav.json"; - global.FAV_NODES = file_exists(favPath)? json_load_struct(favPath) : []; + global.FAV_NODES = file_exists_empty(favPath)? json_load_struct(favPath) : []; if(!is_array(global.FAV_NODES)) global.FAV_NODES = []; var recPath = DIRECTORY + "Nodes/recent.json"; - global.RECENT_NODES = file_exists(recPath)? json_load_struct(recPath) : []; + global.RECENT_NODES = file_exists_empty(recPath)? json_load_struct(recPath) : []; if(!is_array(global.RECENT_NODES)) global.RECENT_NODES = []; NODE_PAGE_DEFAULT = ds_list_size(NODE_CATEGORY); diff --git a/scripts/node_text/node_text.gml b/scripts/node_text/node_text.gml index 8f36ba387..f5375cef5 100644 --- a/scripts/node_text/node_text.gml +++ b/scripts/node_text/node_text.gml @@ -71,7 +71,7 @@ function Node_Text(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) cons _size_current = _size; _aa_current = _aa; - if(!file_exists(_path)) return; + if(!file_exists_empty(_path)) return; if(font != f_p0 && font_exists(font)) font_delete(font); diff --git a/scripts/node_text_file_read/node_text_file_read.gml b/scripts/node_text_file_read/node_text_file_read.gml index ff4ad0226..b8e5f9970 100644 --- a/scripts/node_text_file_read/node_text_file_read.gml +++ b/scripts/node_text_file_read/node_text_file_read.gml @@ -14,7 +14,7 @@ function Node_create_Text_File_Read(_x, _y, _group = noone) { } function Node_create_Text_File_Read_path(_x, _y, path) { - if(!file_exists(path)) return noone; + if(!file_exists_empty(path)) return noone; var node = new Node_Text_File_Read(_x, _y, PANEL_GRAPH.getCurrentContext()); node.inputs[| 0].setValue(path); diff --git a/scripts/node_wav_file_read/node_wav_file_read.gml b/scripts/node_wav_file_read/node_wav_file_read.gml index f3deb202e..b2194bd39 100644 --- a/scripts/node_wav_file_read/node_wav_file_read.gml +++ b/scripts/node_wav_file_read/node_wav_file_read.gml @@ -14,7 +14,7 @@ function Node_create_WAV_File_Read(_x, _y, _group = noone) { #region } #endregion function Node_create_WAV_File_Read_path(_x, _y, path) { #region - if(!file_exists(path)) return noone; + if(!file_exists_empty(path)) return noone; var node = new Node_WAV_File_Read(_x, _y, PANEL_GRAPH.getCurrentContext()); node.inputs[| 0].setValue(path); diff --git a/scripts/node_websocket_sender/node_websocket_sender.gml b/scripts/node_websocket_sender/node_websocket_sender.gml index d390373dd..1e6f2621f 100644 --- a/scripts/node_websocket_sender/node_websocket_sender.gml +++ b/scripts/node_websocket_sender/node_websocket_sender.gml @@ -127,7 +127,7 @@ function Node_Websocket_Sender(_x, _y, _group = noone) : Node(_x, _y, _group) co break; case 2 : var _path = getInputData(4); - if(!file_exists(_path)) return; + if(!file_exists_empty(_path)) return; _buff = buffer_from_file(_path); break; case 3 : diff --git a/scripts/palette_functions/palette_functions.gml b/scripts/palette_functions/palette_functions.gml index 5194c2ad0..093979c69 100644 --- a/scripts/palette_functions/palette_functions.gml +++ b/scripts/palette_functions/palette_functions.gml @@ -12,7 +12,7 @@ function isPaletteFile(path) { #region } #endregion function loadPalette(path) { #region - if(!file_exists(path)) return []; + if(!file_exists_empty(path)) return []; if(!isPaletteFile(path)) return []; var ext = string_lower(filename_ext(path)); diff --git a/scripts/panel_function/panel_function.gml b/scripts/panel_function/panel_function.gml index 4549e09db..34ed92aaf 100644 --- a/scripts/panel_function/panel_function.gml +++ b/scripts/panel_function/panel_function.gml @@ -137,7 +137,7 @@ panelObjectInit(); var file = $"{DIRECTORY}layouts/{PREFERENCES.panel_layout_file}.json"; - if(!file_exists(file)) + if(!file_exists_empty(file)) file = DIRECTORY + "layouts/Horizontal.json"; loadPanel(file, PANEL_MAIN); diff --git a/scripts/panel_graph/panel_graph.gml b/scripts/panel_graph/panel_graph.gml index 9bfb60969..c9727e431 100644 --- a/scripts/panel_graph/panel_graph.gml +++ b/scripts/panel_graph/panel_graph.gml @@ -1705,7 +1705,7 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor { else if(filename_ext(txt) == ".pxcc") APPEND(txt); else if(filename_ext(txt) == ".png") { - if(file_exists(txt)) { + if(file_exists_empty(txt)) { Node_create_Image_path(0, 0, txt); return; } diff --git a/scripts/panel_inspector/panel_inspector.gml b/scripts/panel_inspector/panel_inspector.gml index 9f309af7e..03ff2ef32 100644 --- a/scripts/panel_inspector/panel_inspector.gml +++ b/scripts/panel_inspector/panel_inspector.gml @@ -807,7 +807,7 @@ function Panel_Inspector() : PanelContent() constructor { var txt = "Untitled"; var context = PANEL_GRAPH.getCurrentContext(); - if(context == noone && file_exists(PROJECT.path)) + if(context == noone && file_exists_empty(PROJECT.path)) txt = string_replace(filename_name(PROJECT.path), filename_ext(PROJECT.path), ""); else if(context != noone) txt = context.name; diff --git a/scripts/path_parser/path_parser.gml b/scripts/path_parser/path_parser.gml index 68d5f3e53..47e662e94 100644 --- a/scripts/path_parser/path_parser.gml +++ b/scripts/path_parser/path_parser.gml @@ -1,9 +1,9 @@ function try_get_path(path) { - if(file_exists(path)) + if(file_exists_empty(path)) return path; var local_path = filename_dir(PROJECT.path) + "/" + path; - if(file_exists(local_path)) + if(file_exists_empty(local_path)) return local_path; return -1; diff --git a/scripts/path_reader/path_reader.gml b/scripts/path_reader/path_reader.gml index 4bd227de2..c7d78e793 100644 --- a/scripts/path_reader/path_reader.gml +++ b/scripts/path_reader/path_reader.gml @@ -33,14 +33,14 @@ function paths_to_array(paths, recur = false, _filter = "") { } ds_stack_destroy(st); - } else if(file_exists(paths)) + } else if(file_exists_empty(paths)) array_push(_paths, paths); return _paths; } function path_is_image(path) { - if(!file_exists(path)) return false; + if(!file_exists_empty(path)) return false; var ext = filename_ext(path); switch(ext) { diff --git a/scripts/patreon_email_check/patreon_email_check.gml b/scripts/patreon_email_check/patreon_email_check.gml index 85a6f09fe..6f1713584 100644 --- a/scripts/patreon_email_check/patreon_email_check.gml +++ b/scripts/patreon_email_check/patreon_email_check.gml @@ -22,7 +22,7 @@ function __initPatreon() { IS_PATREON = false; var _path = DIRECTORY + "patreon"; - if(!file_exists(_path)) return; + if(!file_exists_empty(_path)) return; var _map = ds_map_secure_load(_path); diff --git a/scripts/preferences/preferences.gml b/scripts/preferences/preferences.gml index 9d69c027d..5cebcb7ee 100644 --- a/scripts/preferences/preferences.gml +++ b/scripts/preferences/preferences.gml @@ -115,7 +115,7 @@ function RECENT_LOAD() { var path = DIRECTORY + "recent.json"; - if(!file_exists(path)) return; + if(!file_exists_empty(path)) return; var file = file_text_open_read(path); var load_str = ""; @@ -130,7 +130,7 @@ ds_list_clear(RECENT_FILES); for(var i = 0; i < ds_list_size(l); i++) { - if(!file_exists(l[| i])) continue; + if(!file_exists_empty(l[| i])) continue; ds_list_add(RECENT_FILES, l[| i]); } } @@ -182,7 +182,7 @@ function PREF_LOAD() { var path = DIRECTORY + "keys.json"; - if(!file_exists(path)) return; + if(!file_exists_empty(path)) return; var map = json_load_struct(path); if(array_empty(variable_struct_get_names(map))) return; diff --git a/scripts/preset_data/preset_data.gml b/scripts/preset_data/preset_data.gml index d77131c39..fe359fe34 100644 --- a/scripts/preset_data/preset_data.gml +++ b/scripts/preset_data/preset_data.gml @@ -7,7 +7,7 @@ var _preset_path = "data/Preset.zip"; var root = DIRECTORY + "Presets"; directory_verify(root); - if(check_version($"{root}/version") && file_exists(_preset_path)) + if(check_version($"{root}/version") && file_exists_empty(_preset_path)) zip_unzip(_preset_path, root); global.PRESETS = new DirectoryObject("Presets", root); diff --git a/scripts/project_data/project_data.gml b/scripts/project_data/project_data.gml index a761640c1..69c803c98 100644 --- a/scripts/project_data/project_data.gml +++ b/scripts/project_data/project_data.gml @@ -6,11 +6,11 @@ function Project() constructor { active = true; /// @is {bool} - meta = __getdefaultMetaData(); - path = ""; /// @is {string} - thumbnail = ""; - version = SAVE_VERSION; /// @is {number} - seed = irandom_range(100000, 999999); /// @is {number} + meta = __getdefaultMetaData(); + path = ""; /// @is {string} + thumbnail = ""; + version = SAVE_VERSION; /// @is {number} + seed = irandom_range(100000, 999999); /// @is {number} modified = false; /// @is {bool} readonly = false; /// @is {bool} @@ -23,7 +23,6 @@ nodeTopo = ds_list_create(); animator = new AnimationManager(); - globalNode = new Node_Global(); previewGrid = { #region diff --git a/scripts/sample_projects/sample_projects.gml b/scripts/sample_projects/sample_projects.gml index 02cdba429..820f9c9a3 100644 --- a/scripts/sample_projects/sample_projects.gml +++ b/scripts/sample_projects/sample_projects.gml @@ -13,7 +13,7 @@ function LOAD_FOLDER(list, folder) { #region var f = new FileObject(filename_name_only(file), full_path); var icon_path = string_replace(full_path, filename_ext(full_path), ".png"); - if(file_exists(icon_path)) { + if(file_exists_empty(icon_path)) { f.spr = sprite_add(icon_path, 0, false, false, 0, 0); sprite_set_offset(f.spr, sprite_get_width(f.spr) / 2, sprite_get_height(f.spr) / 2); } diff --git a/scripts/save_function/save_function.gml b/scripts/save_function/save_function.gml index 3691a545b..4aa79c69c 100644 --- a/scripts/save_function/save_function.gml +++ b/scripts/save_function/save_function.gml @@ -98,7 +98,7 @@ function SAVE_AS(project = PROJECT) { #region if(filename_ext(path) != ".pxc") path += ".pxc"; - if(file_exists(path)) + if(file_exists_empty(path)) log_warning("SAVE", "Overrided file : " + path); SAVE_AT(project, path); SET_PATH(project, path); @@ -113,7 +113,7 @@ function SAVE_AT(project = PROJECT, path = "", log = "save at ") { #region //if(TESTING && string_char_at(filename_name(path), 1) != "[") // path = $"{filename_dir(path)}/[{VERSION_STRING}] {filename_name(path)}"; - if(file_exists(path)) file_delete(path); + if(file_exists_empty(path)) file_delete(path); file_text_write_all(path, save_serialize(project)); SAVING = false; diff --git a/scripts/sprite_add_functions/sprite_add_functions.gml b/scripts/sprite_add_functions/sprite_add_functions.gml index 59573ddd2..278b6cb7d 100644 --- a/scripts/sprite_add_functions/sprite_add_functions.gml +++ b/scripts/sprite_add_functions/sprite_add_functions.gml @@ -1,5 +1,5 @@ function sprite_add_center(path) { - if(!file_exists(path)) return noone; + if(!file_exists_empty(path)) return noone; var _s = sprite_add(path, 0, 0, 0, 0, 0); diff --git a/scripts/sprite_loader/sprite_loader.gml b/scripts/sprite_loader/sprite_loader.gml index 0b030e360..689086c32 100644 --- a/scripts/sprite_loader/sprite_loader.gml +++ b/scripts/sprite_loader/sprite_loader.gml @@ -14,7 +14,7 @@ function __initTheme() { #region function _sprite_path(rel, theme) { #region INLINE - return $"{DIRECTORY}themes/{theme}/graphics/{string_replace_all(rel, "./", "")}"; + return $"{DIRECTORY}Themes/{theme}/graphics/{string_replace_all(rel, "./", "")}"; } #endregion function _sprite_load_from_struct(str, theme, key) { #region @@ -51,7 +51,8 @@ function __getGraphicList() { #region function loadGraphic(theme = "default") { #region var sprDef = __getGraphicList(); var _metaP = $"{DIRECTORY}Themes/{theme}/meta.json"; - if(!file_exists(_metaP)) + + if(!file_exists_empty(_metaP)) noti_warning("Loading theme made for older version."); else { var _meta = json_load_struct(_metaP); @@ -62,7 +63,7 @@ function loadGraphic(theme = "default") { #region var path = _sprite_path("./graphics.json", theme); print($"Loading theme {theme}"); - if(!file_exists(path)) { + if(!file_exists_empty(path)) { print("Theme not defined at " + path + ", rollback to default theme."); return; } diff --git a/scripts/steam_ugc_collection/steam_ugc_collection.gml b/scripts/steam_ugc_collection/steam_ugc_collection.gml index 245b2856c..cc8560ff0 100644 --- a/scripts/steam_ugc_collection/steam_ugc_collection.gml +++ b/scripts/steam_ugc_collection/steam_ugc_collection.gml @@ -50,7 +50,7 @@ function steam_ugc_update_collection(file, update_preview = false, update_note = steam_ugc_set_item_tags(STEAM_UGC_UPDATE_HANDLE, tgs); steam_ugc_set_item_content(STEAM_UGC_UPDATE_HANDLE, DIRECTORY + "steamUGC"); - if(file_exists(TEMPDIR + "steamUGCthumbnail.png")) + if(file_exists_empty(TEMPDIR + "steamUGCthumbnail.png")) steam_ugc_set_item_preview(STEAM_UGC_UPDATE_HANDLE, TEMPDIR + "steamUGCthumbnail.png"); STEAM_UGC_SUBMIT_ID = steam_ugc_submit_item_update(STEAM_UGC_UPDATE_HANDLE, update_note); diff --git a/scripts/steam_ugc_functions/steam_ugc_functions.gml b/scripts/steam_ugc_functions/steam_ugc_functions.gml index d677823b0..baf6e7a60 100644 --- a/scripts/steam_ugc_functions/steam_ugc_functions.gml +++ b/scripts/steam_ugc_functions/steam_ugc_functions.gml @@ -61,7 +61,7 @@ function __loadSteamUGCCollection(file_id, f, path) { var name = string_replace(filename_name(f), ".pxcc", ""); var file = new FileObject(name, path + "/" + f); var icon_path = string_replace(path + "/" + f, ".pxcc", ".png"); - if(file_exists(icon_path)) { + if(file_exists_empty(icon_path)) { var _temp = sprite_add(icon_path, 0, false, false, 0, 0); var ww = sprite_get_width(_temp); var hh = sprite_get_height(_temp); diff --git a/scripts/steam_ugc_project/steam_ugc_project.gml b/scripts/steam_ugc_project/steam_ugc_project.gml index 255163bae..71439bbdd 100644 --- a/scripts/steam_ugc_project/steam_ugc_project.gml +++ b/scripts/steam_ugc_project/steam_ugc_project.gml @@ -37,7 +37,7 @@ function steam_ugc_update_project(update_preview = false, update_note = "Updated directory_create(DIRECTORY + "steamUGC"); file_copy(file.path, DIRECTORY + "steamUGC/" + filename_name(file.path)); - if(file_exists(PROJECT.thumbnail)) + if(file_exists_empty(PROJECT.thumbnail)) file_copy(PROJECT.thumbnail, DIRECTORY + "steamUGC/thumbnail.png"); STEAM_UGC_PUBLISH_ID = file.meta.file_id; @@ -55,7 +55,7 @@ function steam_ugc_update_project(update_preview = false, update_note = "Updated steam_ugc_set_item_tags(STEAM_UGC_UPDATE_HANDLE, tgs); steam_ugc_set_item_content(STEAM_UGC_UPDATE_HANDLE, DIRECTORY + "steamUGC"); - if(file_exists(TEMPDIR + "steamUGCthumbnail.png")) + if(file_exists_empty(TEMPDIR + "steamUGCthumbnail.png")) steam_ugc_set_item_preview(STEAM_UGC_UPDATE_HANDLE, TEMPDIR + "steamUGCthumbnail.png"); STEAM_UGC_SUBMIT_ID = steam_ugc_submit_item_update(STEAM_UGC_UPDATE_HANDLE, update_note); diff --git a/scripts/text_file/text_file.gml b/scripts/text_file/text_file.gml index d91cdff49..4b4611c39 100644 --- a/scripts/text_file/text_file.gml +++ b/scripts/text_file/text_file.gml @@ -1,14 +1,16 @@ function file_read_all(path) { - gml_pragma("forceinline"); + INLINE var f = file_text_open_read(path); - var s = file_text_read_all(f); + var s = ""; + while(!file_text_eof(f)) + s += file_text_readln(f); file_text_close(f); return s; } function file_text_read_all_lines(path) { - gml_pragma("forceinline"); + INLINE var f = file_text_open_read(path); var s = []; @@ -19,9 +21,9 @@ function file_text_read_all_lines(path) { } function file_text_write_all(path, str) { - gml_pragma("forceinline"); + INLINE - if(file_exists(path)) file_delete(path); + if(file_exists_empty(path)) file_delete(path); var f = file_text_open_write(path); file_text_write_string(f, str); diff --git a/scripts/version_checker/version_checker.gml b/scripts/version_checker/version_checker.gml index b661b447f..ad373632f 100644 --- a/scripts/version_checker/version_checker.gml +++ b/scripts/version_checker/version_checker.gml @@ -1,5 +1,5 @@ function check_version(path) { - if(!file_exists(path)) { + if(!file_exists_empty(path)) { json_save_struct(path, { version: BUILD_NUMBER }); return true; }