mirror of
https://dev.iopsys.eu/bbf/bbfdm.git
synced 2025-12-10 07:44:39 +01:00
76 lines
2 KiB
C
76 lines
2 KiB
C
/*
|
|
* Copyright (C) 2025 iopsys Software Solutions AB
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify
|
|
* it under the terms of the GNU Lesser General Public License version 2.1
|
|
* as published by the Free Software Foundation
|
|
*
|
|
* Author: Amin Ben Romdhane <amin.benromdhane@iopsys.eu>
|
|
*
|
|
*/
|
|
|
|
#ifndef __BBFDM_SYSTEM_H
|
|
#define __BBFDM_SYSTEM_H
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
/**
|
|
* @brief Check if a folder exists at the given path.
|
|
*
|
|
* This function verifies the existence of a folder at the specified path.
|
|
*
|
|
* @param[in] path Path to the folder.
|
|
* @return true if the folder exists, false otherwise.
|
|
*/
|
|
bool bbfdm_folder_exists(const char *path);
|
|
|
|
/**
|
|
* @brief Check if a file exists at the given path.
|
|
*
|
|
* This function verifies the existence of a file at the specified path.
|
|
*
|
|
* @param[in] path Path to the file.
|
|
* @return true if the file exists, false otherwise.
|
|
*/
|
|
bool bbfdm_file_exists(const char *path);
|
|
|
|
/**
|
|
* @brief Check if a file is a regular file.
|
|
*
|
|
* This function determines whether the file at the specified path is a regular file.
|
|
*
|
|
* @param[in] path Path to the file.
|
|
* @return true if the file is a regular file, false otherwise.
|
|
*/
|
|
bool bbfdm_is_regular_file(const char *path);
|
|
|
|
/**
|
|
* @brief Create an empty file at the specified path.
|
|
*
|
|
* This function creates an empty file if it does not already exist. If the file already exists, it skips creation.
|
|
*
|
|
* @param[in] path Path to the file.
|
|
* @return 0 on success, -1 on failure.
|
|
*/
|
|
int bbfdm_create_empty_file(const char *path);
|
|
|
|
/**
|
|
* @brief Copy a string with a guaranteed null termination.
|
|
*
|
|
* This function copies up to `n - 1` characters from `src` to `dst` and ensures
|
|
* the destination string is null-terminated. If `n` is 1 or less, no copying occurs.
|
|
*
|
|
* @param[out] dst Destination buffer.
|
|
* @param[in] src Source string.
|
|
* @param[in] n Size of the destination buffer.
|
|
*/
|
|
void bbfdm_strncpy(char *dst, const char *src, size_t n);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif //__BBFDM_SYSTEM_H
|
|
|