# HG changeset patch # User Matti Hamalainen # Date 1687125928 -10800 # Node ID 28f3bf45d5d7e13853f1211949e967f592726283 # Parent c43a4607dbc0715c844b50b562309439dd9094a9 Adjust -D option so that if map or loc filenames have absolute paths, data path will not get prepended. diff -r c43a4607dbc0 -r 28f3bf45d5d7 src/mapsearch.c --- 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,