Mercurial > hg > dmlib
diff src/dmres.c @ 2106:78a0f44aa8b5
Clean out the resource path handling.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Wed, 08 May 2019 13:56:10 +0300 |
parents | 0d7c73f42a0b |
children | 8962901faf5d |
line wrap: on
line diff
--- a/src/dmres.c Mon Apr 29 14:09:01 2019 +0300 +++ b/src/dmres.c Wed May 08 13:56:10 2019 +0300 @@ -174,7 +174,8 @@ */ static int dm_stdio_fopen(DMResource *handle) { - char *rfilename = dm_strdup_printf("%s%s", DMRES_DATA_PATH, handle->filename); + char *dpath = handle->lib != NULL ? handle->lib->resPath : NULL; + char *rfilename = dm_strdup_printf("%s%s", dpath != NULL ? dpath : "", handle->filename); if (rfilename == NULL) return DMERR_MALLOC; @@ -1086,7 +1087,7 @@ // Basic data lib->mutex = dmCreateMutex(); lib->flags = flags; - lib->resPath = dm_strdup((path != NULL) ? path : DMRES_DATA_PATH); + lib->resPath = dm_strdup(path); #ifdef DM_USE_PACKFS @@ -1095,7 +1096,7 @@ int ret; DMPackEntry *node; - lib->packFilename = dm_strdup((filename != NULL) ? filename : DMRES_DATA_PACK); + lib->packFilename = dm_strdup(filename); // Initialize PACK, open as read-only ret = dmPackOpen(lib->packFilename, &lib->packFile, TRUE);