2 * Copyright (C) 2024 Mikulas Patocka
4 * This file is part of Ajla.
6 * Ajla is free software: you can redistribute it and/or modify it under the
7 * terms of the GNU General Public License as published by the Free Software
8 * Foundation, either version 3 of the License, or (at your option) any later
11 * Ajla is distributed in the hope that it will be useful, but WITHOUT ANY
12 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
13 * A PARTICULAR PURPOSE. See the GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License along with
16 * Ajla. If not, see <https://www.gnu.org/licenses/>.
19 #ifndef AJLA_OS_UTIL_H
20 #define AJLA_OS_UTIL_H
24 bool os_read_file(const char *path
, char **file
, size_t *len
, ajla_error_t
*err
);
25 bool os_pread_all(handle_t h
, char *ptr
, size_t len
, os_off_t offset
, ajla_error_t
*err
);
26 bool os_write_all(handle_t h
, const char *data
, size_t len
, ajla_error_t
*err
);
28 bool os_test_absolute_path(dir_handle_t dir
, bool abs_path
,ajla_error_t
*err
);
29 bool os_path_is_absolute(const char *path
);
30 char *os_join_paths(const char *base
, const char *path
, bool trim_last_slash
, ajla_error_t
*err
);
31 char *os_get_directory_cache(ajla_error_t
*err
);
32 bool os_create_directory_parents(const char *path
, ajla_error_t
*err
);
33 bool os_write_atomic(const char *path
, const char *filename
, const char *data
, size_t data_len
, ajla_error_t
*err
);