X-Git-Url: https://git.xonotic.org/?p=xonotic%2Fgmqcc.git;a=blobdiff_plain;f=util.c;h=a900889e57b90f983d776c44326e02935d9eee7b;hp=77753a9be006d3add446d1a3bde7c9d9924091fc;hb=091173341eace2d290f6c0ebc4159c3afca7fbaa;hpb=4517072af46dad9993b19de6840c7eb15ec22a02 diff --git a/util.c b/util.c index 77753a9..a900889 100644 --- a/util.c +++ b/util.c @@ -521,6 +521,15 @@ FILE *util_fopen(const char *filename, const char *mode) #endif } +bool util_filexists(const char *file) { + FILE *fp = fopen(file, "rb"); + if (!fp) return false; + + /* it exists */ + fclose(fp); + return true; +} + void _util_vec_grow(void **a, size_t i, size_t s) { size_t m = *a ? 2*_vec_beg(*a)+i : i+1; void *p = mem_r((*a ? _vec_raw(*a) : NULL), s * m + sizeof(size_t)*2);