Update gb.h

This commit is contained in:
Ginger Bill
2017-07-31 12:17:53 +01:00
parent 4d14b3bcb4
commit e4a93619db
2 changed files with 13 additions and 12 deletions
+6 -5
View File
@@ -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;
}
+7 -7
View File
@@ -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) {