commit c7bec81c13e696a24ceadc4edcdbdb05d3dc703d
parent 5e6461ed6eb89f379ab3b824a1a3bcbc296c3481
Author: Brian Swetland <swetland@frotz.net>
Date: Sat, 22 Jun 2013 01:38:29 -0700
io: provide a way to disable the asset path search stuff
Handy for commandline tools.
Diffstat:
2 files changed, 15 insertions(+), 1 deletion(-)
diff --git a/common/io.cc b/common/io.cc
@@ -23,7 +23,7 @@
static char base_path[1024 + 8] = "";
-static const char *search[] = {
+static const char *defaultsearch[] = {
#ifdef _WIN32
"assets\\",
#else
@@ -33,6 +33,17 @@ static const char *search[] = {
NULL,
};
+static const char *nosearch[] = {
+ "",
+ NULL,
+};
+
+static const char **search = defaultsearch;
+
+void io_ignore_asset_paths(void) {
+ base_path[0] = 0;
+ search = nosearch;
+}
FILE *fopen_asset(const char *fn, const char *kind) {
char path[2048 + 64];
FILE *fp;
diff --git a/common/util.h b/common/util.h
@@ -25,6 +25,9 @@ int file_get_mtime(const char *fn);
int save_png_rgba(const char *fn, void *data, unsigned width, unsigned height);
int save_png_gray(const char *fn, void *data, unsigned width, unsigned height);
+/* tread filenames as normal filenames, don't use asset search process */
+void io_ignore_asset_paths(void);
+
/* model helpers */
struct model {