2023-08-15 16:20:26 +02:00
|
|
|
/* SPDX-FileCopyrightText: 2023 Blender Authors
|
2023-05-31 16:19:06 +02:00
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: GPL-2.0-or-later */
|
2023-03-23 10:56:42 +01:00
|
|
|
|
|
|
|
/** \file
|
|
|
|
* \ingroup bli
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2024-03-04 01:30:01 +01:00
|
|
|
#include "BLI_compiler_attrs.h"
|
2023-03-23 10:56:42 +01:00
|
|
|
#include "BLI_sys_types.h"
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2024-02-28 23:35:03 +01:00
|
|
|
/**
|
2024-03-04 01:30:01 +01:00
|
|
|
* Sets `tempdir` from `dirpath` when it's a valid directory.
|
2024-02-28 23:35:03 +01:00
|
|
|
* Simple sanitize operations are performed and a trailing slash is ensured.
|
|
|
|
*/
|
2024-03-04 01:30:01 +01:00
|
|
|
bool BLI_temp_directory_path_copy_if_valid(char *tempdir,
|
|
|
|
const size_t tempdir_maxncpy,
|
|
|
|
const char *dirpath) ATTR_NONNULL(1, 3);
|
2024-02-28 23:35:03 +01:00
|
|
|
|
2024-03-04 01:30:01 +01:00
|
|
|
/**
|
|
|
|
* Get the path to a directory suitable for temporary files.
|
2023-03-23 10:56:42 +01:00
|
|
|
*
|
|
|
|
* The return path is guaranteed to exist and to be a directory, as well as to contain a trailing
|
|
|
|
* directory separator.
|
|
|
|
*
|
2024-03-04 01:30:01 +01:00
|
|
|
* At maximum the `tempdir_maxncpy` number of characters is written to the `tempdir`.
|
|
|
|
* The directory path is always null-terminated.
|
|
|
|
*/
|
|
|
|
void BLI_temp_directory_path_get(char *tempdir, const size_t tempdir_maxncpy) ATTR_NONNULL(1);
|
2023-03-23 10:56:42 +01:00
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|