summaryrefslogtreecommitdiff
path: root/source/kit/file.c
diff options
context:
space:
mode:
Diffstat (limited to 'source/kit/file.c')
-rw-r--r--source/kit/file.c29
1 files changed, 14 insertions, 15 deletions
diff --git a/source/kit/file.c b/source/kit/file.c
index e5b834f..76d3249 100644
--- a/source/kit/file.c
+++ b/source/kit/file.c
@@ -276,7 +276,7 @@ static void kit_prepare_path_(char *buf, kit_str_t path) {
char buf[PATH_BUF_SIZE]; \
kit_prepare_path_(buf, path)
-kit_status_t kit_folder_create(kit_str_t path) {
+s32 kit_folder_create(kit_str_t path) {
PREPARE_PATH_BUF_;
#if defined(_WIN32) && !defined(__CYGWIN__)
return CreateDirectoryA(buf, NULL) ? KIT_OK
@@ -286,14 +286,14 @@ kit_status_t kit_folder_create(kit_str_t path) {
#endif
}
-kit_status_t kit_folder_create_recursive(kit_str_t path) {
+s32 kit_folder_create_recursive(kit_str_t path) {
for (i32 i = 0;; i++) {
str_t part = kit_path_take(path, i);
i32 type = kit_path_type(part);
if (type == KIT_PATH_FILE)
return KIT_ERROR_FILE_ALREADY_EXISTS;
if (type == KIT_PATH_NONE) {
- kit_status_t s = kit_folder_create(part);
+ s32 s = kit_folder_create(part);
if (s != KIT_OK)
return s;
}
@@ -304,7 +304,7 @@ kit_status_t kit_folder_create_recursive(kit_str_t path) {
return KIT_OK;
}
-kit_status_t kit_file_remove(kit_str_t path) {
+s32 kit_file_remove(kit_str_t path) {
PREPARE_PATH_BUF_;
#if defined(_WIN32) && !defined(__CYGWIN__)
return DeleteFileA(buf) ? KIT_OK : KIT_ERROR_UNLINK_FAILED;
@@ -313,7 +313,7 @@ kit_status_t kit_file_remove(kit_str_t path) {
#endif
}
-kit_status_t kit_folder_remove(kit_str_t path) {
+s32 kit_folder_remove(kit_str_t path) {
PREPARE_PATH_BUF_;
#if defined(_WIN32) && !defined(__CYGWIN__)
return RemoveDirectoryA(buf) ? KIT_OK : KIT_ERROR_RMDIR_FAILED;
@@ -322,14 +322,14 @@ kit_status_t kit_folder_remove(kit_str_t path) {
#endif
}
-kit_status_t kit_file_remove_recursive(kit_str_t path,
- kit_allocator_t *alloc) {
+s32 kit_file_remove_recursive(kit_str_t path,
+ kit_allocator_t *alloc) {
i32 type = kit_path_type(path);
i64 i;
switch (type) {
case KIT_PATH_FILE: {
- kit_status_t s = kit_file_remove(path);
+ s32 s = kit_file_remove(path);
assert(s == KIT_OK);
return s;
}
@@ -346,15 +346,14 @@ kit_status_t kit_file_remove_recursive(kit_str_t path,
for (i = 0; i < list.files.size; i++) {
str_builder_t full_path = kit_path_join(
path, WRAP_STR(list.files.values[i]), alloc);
- kit_status_t s = kit_file_remove_recursive(
- WRAP_STR(full_path), alloc);
+ s32 s = kit_file_remove_recursive(WRAP_STR(full_path), alloc);
DA_DESTROY(full_path);
assert(s == KIT_OK);
}
kit_path_list_destroy(list);
- kit_status_t s = kit_folder_remove(path);
+ s32 s = kit_folder_remove(path);
assert(s == KIT_OK);
return s;
}
@@ -652,13 +651,13 @@ kit_mapped_file_t kit_file_map(kit_str_t path, i64 size, i32 mode) {
return mf;
}
-kit_status_t kit_file_sync(kit_mapped_file_t *mf) {
+s32 kit_file_sync(kit_mapped_file_t *mf) {
assert(mf != NULL);
if (mf == NULL)
return KIT_ERROR_INVALID_ARGUMENT;
- kit_status_t status = KIT_OK;
+ s32 status = KIT_OK;
#if !defined(_WIN32) || defined(__CYGWIN__)
if (msync(mf->bytes, mf->size, MS_SYNC) != 0)
@@ -668,13 +667,13 @@ kit_status_t kit_file_sync(kit_mapped_file_t *mf) {
return status;
}
-kit_status_t kit_file_unmap(kit_mapped_file_t *mf) {
+s32 kit_file_unmap(kit_mapped_file_t *mf) {
assert(mf != NULL);
if (mf == NULL)
return KIT_ERROR_INVALID_ARGUMENT;
- kit_status_t status = KIT_OK;
+ s32 status = KIT_OK;
#if defined(_WIN32) && !defined(__CYGWIN__)
if (!UnmapViewOfFile(mf->bytes))