Pixel-Composer/scripts/file_functions/file_functions.gml

38 lines
1 KiB
Text
Raw Normal View History

2023-12-08 09:50:09 +07:00
function file_exists_empty(path) { INLINE return path != "" && file_exists(path); }
2024-02-15 20:23:26 +07:00
function file_copy_override(src, dest) { #region
2023-12-08 09:50:09 +07:00
if(file_exists_empty(dest)) file_delete(dest);
file_copy(src, dest);
2024-02-15 20:23:26 +07:00
} #endregion
2023-11-01 14:10:25 +07:00
2024-02-15 20:23:26 +07:00
function filepath_resolve(path) { #region
2023-11-08 14:38:04 +07:00
INLINE
2023-11-01 14:10:25 +07:00
var _path = path;
_path = string_replace_all(_path, "%DIR%/", DIRECTORY);
_path = string_replace_all(_path, "%APP%/", APP_LOCATION);
2023-11-01 14:10:25 +07:00
return _path;
2024-02-15 20:23:26 +07:00
} #endregion
2023-11-08 10:48:09 +07:00
2024-02-15 20:23:26 +07:00
function get_open_filenames_compat(ext, sel) { #region
2023-12-12 20:41:50 +07:00
INLINE
2023-12-13 17:09:06 +07:00
2023-12-15 18:56:36 +07:00
if(OS == os_windows) return get_open_filenames(ext, sel);
return get_open_filename(ext, sel);
2024-02-15 20:23:26 +07:00
} #endregion
function file_get_modify_s(path) { #region
INLINE
if(!file_exists(path)) return 0;
var _y = file_datetime_modified_year(path);
var _m = file_datetime_modified_month(path);
var _d = file_datetime_modified_day(path);
var _h = file_datetime_modified_hour(path);
var _n = file_datetime_modified_minute(path);
var _s = file_datetime_modified_second(path);
return ((((_y * 12 + _m) * 31 + _d) * 24 + _h) * 60 + _n) * 60 + _s;
} #endregion