Mercurial > repos > blastem
comparison util.c @ 1693:ba3fb7a3be6b
Added some Makefile options to build a packaging friendly executable
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Tue, 22 Jan 2019 21:15:38 -0800 |
parents | c362f2c7766a |
children | eda8df5bc74c |
comparison
equal
deleted
inserted
replaced
1691:e96d0d3bec7f | 1693:ba3fb7a3be6b |
---|---|
873 | 873 |
874 #else | 874 #else |
875 | 875 |
876 char *read_bundled_file(char *name, uint32_t *sizeret) | 876 char *read_bundled_file(char *name, uint32_t *sizeret) |
877 { | 877 { |
878 char *exe_dir = get_exe_dir(); | 878 #ifdef DATA_PATH |
879 if (!exe_dir) { | 879 char *data_dir = DATA_PATH; |
880 #else | |
881 char *data_dir = get_exe_dir(); | |
882 if (!data_dir) { | |
880 if (sizeret) { | 883 if (sizeret) { |
881 *sizeret = -1; | 884 *sizeret = -1; |
882 } | 885 } |
883 return NULL; | 886 return NULL; |
884 } | 887 } |
885 char const *pieces[] = {exe_dir, PATH_SEP, name}; | 888 #endif |
889 char const *pieces[] = {data_dir, PATH_SEP, name}; | |
886 char *path = alloc_concat_m(3, pieces); | 890 char *path = alloc_concat_m(3, pieces); |
887 FILE *f = fopen(path, "rb"); | 891 FILE *f = fopen(path, "rb"); |
888 free(path); | 892 free(path); |
889 if (!f) { | 893 if (!f) { |
890 if (sizeret) { | 894 if (sizeret) { |