added bool value return to dir_create

This commit is contained in:
2025-08-04 19:15:30 +03:00
parent e1dc972b24
commit 223406d4e4
3 changed files with 7 additions and 6 deletions

View File

@@ -22,9 +22,9 @@ bool dir_exists(cstr path){
#endif
}
Result(void) dir_create(cstr path){
Result(bool) dir_create(cstr path){
if (dir_exists(path))
return RESULT_VOID;
return RESULT_VALUE(i, false);
char* parentDir= str_copy(path_dirname(str_from_cstr((void*)path))).data;
try_void(dir_create(parentDir), free(parentDir));
@@ -38,5 +38,5 @@ Result(void) dir_create(cstr path){
return RESULT_ERROR_FMT("Can't create dicectory '%s': %s", path, strerror(errno));
}
return RESULT_VOID;
return RESULT_VALUE(i, true);
}