@@ -87,6 +87,36 @@ int fossil_sanity_sys_create_file(const char* filename);
8787 */
8888int fossil_sanity_sys_file_exists (const char * filename );
8989
90+ /**
91+ * @brief Creates an empty directory at the specified location.
92+ *
93+ * This function attempts to create an empty directory with the given name. If the directory
94+ * already exists, the function may return an error or success depending on the system's
95+ * behavior. The function returns a status code indicating success or failure.
96+ *
97+ * @param dirname A null-terminated string representing the path to the directory to be created.
98+ * The path can be relative or absolute.
99+ * @return int Returns 0 on successful creation of the directory. Returns a negative value if
100+ * the directory could not be created due to errors such as insufficient permissions
101+ * or invalid paths.
102+ */
103+ int fossil_sanity_sys_create_dir (const char * dirname );
104+
105+ /**
106+ * @brief Checks whether a directory exists at the specified location.
107+ *
108+ * This function determines if a directory exists at the given path. It can be used to verify
109+ * the presence of a directory before performing operations such as reading or writing. The
110+ * function does not differentiate between regular directories and other file types.
111+ *
112+ * @param dirname A null-terminated string representing the path to the directory to check.
113+ * The path can be relative or absolute.
114+ * @return int Returns 1 if the directory exists, and 0 if it does not exist. Note that this
115+ * function does not check for directory accessibility or permissions.
116+ */
117+ int fossil_sanity_sys_dir_exists (const char * dirname );
118+
119+
90120#ifdef __cplusplus
91121}
92122#endif
@@ -166,6 +196,35 @@ int fossil_sanity_sys_file_exists(const char* filename);
166196#define _FOSSIL_SANITY_SYS_FILE_EXISTS (filename ) \
167197 fossil_sanity_sys_file_exists(filename)
168198
199+ /**
200+ * @brief Creates an empty directory at the specified location.
201+ * This function attempts to create an empty directory with the given name. If the directory
202+ * already exists, the function may return an error or success depending on the system's
203+ * behavior.
204+ *
205+ * @param dirname A null-terminated string representing the path to the directory to be created.
206+ * The path can be relative or absolute.
207+ * @return int Returns 0 on successful creation of the directory. Returns a negative value if
208+ * the directory could not be created due to errors such as insufficient permissions
209+ * or invalid paths.
210+ */
211+ #define _FOSSIL_SANITY_SYS_CREATE_DIR (dirname ) \
212+ fossil_sanity_sys_create_dir(dirname)
213+
214+ /**
215+ * @brief Checks whether a directory exists at the specified location.
216+ * This function determines if a directory exists at the given path. It can be used to verify
217+ * the presence of a directory before performing operations such as reading or writing. The
218+ * function does not differentiate between regular files, directories, or other file types.
219+ *
220+ * @param dirname A null-terminated string representing the path to the directory to check.
221+ * The path can be relative or absolute.
222+ * @return int Returns 1 if the directory exists, and 0 if it does not exist. Note that this
223+ * function does not check for directory accessibility or permissions.
224+ */
225+ #define _FOSSIL_SANITY_SYS_DIR_EXISTS (dirname ) \
226+ fossil_sanity_sys_dir_exists(dirname)
227+
169228// *****************************************************************************
170229// Public API Macros
171230// *****************************************************************************
@@ -237,4 +296,31 @@ int fossil_sanity_sys_file_exists(const char* filename);
237296#define FOSSIL_SANITY_SYS_FILE_EXISTS (filename ) \
238297 _FOSSIL_SANITY_SYS_FILE_EXISTS(filename)
239298
299+ /**
300+ * @brief Creates an empty directory at the specified location.
301+ * This macro is a wrapper around the _FOSSIL_SANITY_SYS_CREATE_DIR function.
302+ * It is used to create an empty directory with the given name.
303+ *
304+ * @param dirname A null-terminated string representing the path to the directory to be created.
305+ * The path can be relative or absolute.
306+ * @return int Returns 0 on successful creation of the directory. Returns a negative value if
307+ * the directory could not be created due to errors such as insufficient permissions
308+ * or invalid paths.
309+ */
310+ #define FOSSIL_SANITY_SYS_CREATE_DIR (dirname ) \
311+ _FOSSIL_SANITY_SYS_CREATE_DIR(dirname)
312+
313+ /**
314+ * @brief Checks whether a directory exists at the specified location.
315+ * This macro is a wrapper around the _FOSSIL_SANITY_SYS_DIR_EXISTS function.
316+ * It is used to check if a directory exists at the given path.
317+ *
318+ * @param dirname A null-terminated string representing the path to the directory to check.
319+ * The path can be relative or absolute.
320+ * @return int Returns 1 if the directory exists, and 0 if it does not exist. Note that this
321+ * function does not check for directory accessibility or permissions.
322+ */
323+ #define FOSSIL_SANITY_SYS_DIR_EXISTS (dirname ) \
324+ _FOSSIL_SANITY_SYS_DIR_EXISTS(dirname)
325+
240326#endif // FOSSIL_SANITY_H
0 commit comments