Mercurial > hg > batmud > maputils
changeset 2494:28f3bf45d5d7
Adjust -D option so that if map or loc filenames have absolute paths, data
path will not get prepended.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Mon, 19 Jun 2023 01:05:28 +0300 |
parents | c43a4607dbc0 |
children | 72a3b687e6ce |
files | src/mapsearch.c |
diffstat | 1 files changed, 9 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- a/src/mapsearch.c Mon Jun 19 00:59:35 2023 +0300 +++ b/src/mapsearch.c Mon Jun 19 01:05:28 2023 +0300 @@ -1646,18 +1646,15 @@ { MAPInfoCtx *info = &optMaps[nmap]; - if (optDataPath != NULL) - { - mapFilename = th_strdup_printf("%s%s%s", - optDataPath, TH_DIR_SEPARATOR_STR, info->mapFilename); - locFilename = th_strdup_printf("%s%s%s", - optDataPath, TH_DIR_SEPARATOR_STR, info->locFile.filename); - } - else - { - mapFilename = th_strdup(info->mapFilename); - locFilename = th_strdup(info->locFile.filename); - } + mapFilename = (optDataPath != NULL && strchr("/\\", info->mapFilename[0]) == NULL) ? + th_strdup_printf("%s%s%s", optDataPath, TH_DIR_SEPARATOR_STR, info->mapFilename) + : + th_strdup(info->mapFilename); + + locFilename = (optDataPath != NULL && strchr("/\\", info->locFile.filename[0]) == NULL) ? + th_strdup_printf("%s%s%s", optDataPath, TH_DIR_SEPARATOR_STR, info->locFile.filename) + : + th_strdup(info->locFile.filename); mapMSG(1, "Map ID '%s', data '%s', locations '%s' at [%d, %d]\n", info->locFile.continent,