aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGinger Bill <bill@gingerbill.org>2017-07-31 12:17:53 +0100
committerGinger Bill <bill@gingerbill.org>2017-07-31 12:17:53 +0100
commite4a93619db05d506cb547312d01cf27f1c119116 (patch)
treef5793406be70cd3405f121346f2d31a4200ac60c /src
parent4d14b3bcb482aaaa26bcaedbbaadb055f8bf8c41 (diff)
Update gb.h
Diffstat (limited to 'src')
-rw-r--r--src/gb/gb.h11
-rw-r--r--src/main.cpp14
2 files changed, 13 insertions, 12 deletions
diff --git a/src/gb/gb.h b/src/gb/gb.h
index a369ca6aa..c38c57434 100644
--- a/src/gb/gb.h
+++ b/src/gb/gb.h
@@ -1,4 +1,4 @@
-/* gb.h - v0.30 - Ginger Bill's C Helper Library - public domain
+/* gb.h - v0.31 - Ginger Bill's C Helper Library - public domain
- no warranty implied; use at your own risk
This is a single header file with a bunch of useful stuff
@@ -58,6 +58,7 @@ TODOS
- More date & time functions
VERSION HISTORY
+ 0.31 - Add gb_file_remove
0.30 - Changes to gbThread (and gbMutex on Windows)
0.29 - Add extras for gbString
0.28 - Handle UCS2 correctly in Win32 part
@@ -2056,7 +2057,7 @@ GB_DEF b32 gb_file_exists (char const *filepath);
GB_DEF gbFileTime gb_file_last_write_time(char const *filepath);
GB_DEF b32 gb_file_copy (char const *existing_filename, char const *new_filename, b32 fail_if_exists);
GB_DEF b32 gb_file_move (char const *existing_filename, char const *new_filename);
-GB_DEF b32 gb_file_delete (char const *filename);
+GB_DEF b32 gb_file_remove (char const *filename);
#ifndef GB_PATH_SEPARATOR
@@ -7978,7 +7979,7 @@ gb_inline b32 gb_file_move(char const *existing_filename, char const *new_filena
return result;
}
-b32 gb_file_delete(char const *filename) {
+b32 gb_file_remove(char const *filename) {
wchar_t *w_filename = NULL;
gbAllocator a = gb_heap_allocator();
b32 result = false;
@@ -8036,8 +8037,8 @@ gb_inline b32 gb_file_move(char const *existing_filename, char const *new_filena
return false;
}
-b32 gb_file_delete(char const *filename) {
- return unlink(filename) != -1;
+b32 gb_file_remove(char const *filename) {
+ return remove(filename) == 0;
}
diff --git a/src/main.cpp b/src/main.cpp
index 24878974d..a3cd45283 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -419,19 +419,19 @@ void remove_temp_files(String output_base) {
isize n = output_base.len;
gb_memcopy(data.data, output_base.text, n);
-#define EXT_DELETE(s) do { \
+#define EXT_REMOVE(s) do { \
gb_memcopy(data.data+n, s, gb_size_of(s)); \
- gb_file_delete(cast(char *)data.data); \
+ gb_file_remove(cast(char *)data.data); \
} while (0)
- EXT_DELETE(".ll");
- EXT_DELETE(".bc");
+ EXT_REMOVE(".ll");
+ EXT_REMOVE(".bc");
#if defined(GB_SYSTEM_WINDOWS)
- EXT_DELETE(".obj");
+ EXT_REMOVE(".obj");
#else
- EXT_DELETE(".o");
+ EXT_REMOVE(".o");
#endif
-#undef EXT_DELETE
+#undef EXT_REMOVE
}
int main(int arg_count, char **arg_ptr) {