Pixel-Composer/scripts/text_file/text_file.gml

29 lines
592 B
Text
Raw Normal View History

2023-11-13 07:11:52 +01:00
function file_read_all(path) {
gml_pragma("forceinline");
2023-02-28 09:43:01 +01:00
var f = file_text_open_read(path);
2023-11-13 07:11:52 +01:00
var s = file_text_read_all(f);
2023-02-28 09:43:01 +01:00
file_text_close(f);
2023-01-01 02:06:02 +01:00
return s;
}
2023-02-28 09:43:01 +01:00
function file_text_read_all_lines(path) {
2023-11-13 07:11:52 +01:00
gml_pragma("forceinline");
2023-02-28 09:43:01 +01:00
var f = file_text_open_read(path);
2023-01-04 02:30:04 +01:00
var s = [];
2023-03-22 07:07:38 +01:00
while(!file_text_eof(f))
2023-02-28 09:43:01 +01:00
array_push(s, file_text_readln(f));
file_text_close(f);
2023-01-04 02:30:04 +01:00
return s;
}
2023-02-28 09:43:01 +01:00
function file_text_write_all(path, str) {
2023-11-13 07:11:52 +01:00
gml_pragma("forceinline");
2023-10-18 14:58:55 +02:00
if(file_exists(path)) file_delete(path);
2023-02-28 09:43:01 +01:00
var f = file_text_open_write(path);
2023-01-01 02:06:02 +01:00
file_text_write_string(f, str);
file_text_close(f);
}