Added a function to delete a directory

This commit is contained in:
2024-02-15 00:44:40 +01:00
parent ecb9a595ca
commit a059611982
3 changed files with 103 additions and 4 deletions

View File

@@ -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)