Added a function to delete a directory
This commit is contained in:
31
src/entry.c
31
src/entry.c
@@ -70,6 +70,37 @@ bool entry_exists(const char* entry) {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool create_entry(const char* entry) {
|
||||
char* entry_path = get_entry_path(entry);
|
||||
if (entry_path == NULL)
|
||||
return false;
|
||||
|
||||
// Create the entry directory
|
||||
int result = mkdir(entry_path, 0755);
|
||||
|
||||
// Free the entry path
|
||||
free(entry_path);
|
||||
|
||||
if (result != 0)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool delete_entry(const char* entry) {
|
||||
char* entry_path = get_entry_path(entry);
|
||||
if (entry_path == NULL)
|
||||
return false;
|
||||
|
||||
// Delete the entry directory
|
||||
bool result = delete_directory(entry_path);
|
||||
|
||||
// Free the entry path
|
||||
free(entry_path);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
uint64_t get_available_space(void) {
|
||||
char* entries_path = get_entries_path();
|
||||
if (entries_path == NULL)
|
||||
|
Reference in New Issue
Block a user