summaryrefslogtreecommitdiff
path: root/util.c
diff options
context:
space:
mode:
authorMichael Pavone <pavone@retrodev.com>2019-04-24 19:08:49 -0700
committerMichael Pavone <pavone@retrodev.com>2019-04-24 19:08:49 -0700
commit3905002957a7670fd6ad0762c1a961ae5b7e9810 (patch)
treebd776faa7b78c99d3eae4736ed326eaaf4e2ef1e /util.c
parentf7b6f7fbd9f12ad6ce58496ec87ed7fc67a1dbfc (diff)
Allow config file to be saved with executable for "portable" setups
Diffstat (limited to 'util.c')
-rw-r--r--util.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/util.c b/util.c
index e22dfc2..489f159 100644
--- a/util.c
+++ b/util.c
@@ -854,6 +854,16 @@ void sort_dir_list(dir_entry *list, size_t num_entries)
qsort(list, num_entries, sizeof(dir_entry), sort_dir_alpha);
}
+uint8_t delete_file(char *path)
+{
+#ifdef _WIN32
+ //TODO: Call Unicode version and prepend special string to remove max path limitation
+ return 0 != DeleteFileA(path);
+#else
+ return 0 == unlink(path);
+#endif
+}
+
#ifdef __ANDROID__
#include <SDL.h>
@@ -943,7 +953,7 @@ char *read_bundled_file(char *name, uint32_t *sizeret)
fclose(f);
return ret;
}
-#endif
+#endif //ISLIB
#ifdef _WIN32
char const *get_userdata_dir()
@@ -1000,8 +1010,6 @@ char const *get_userdata_dir()
}
-#endif
-
+#endif //_WIN32
+#endif //__ANDROID__
-
-#endif