From be38dac9fbc2e3dce9ab8da2fcb60b102226407f Mon Sep 17 00:00:00 2001 From: Tim Edwards Date: Sat, 14 Dec 2019 18:30:48 -0500 Subject: [PATCH] Corrected .mag file read-in so that it will not complain about a layout being redefined if one records the full path name and the other records the home directory tilde expression. --- database/DBio.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/database/DBio.c b/database/DBio.c index f27e8d18..a7690b8e 100644 --- a/database/DBio.c +++ b/database/DBio.c @@ -1440,9 +1440,22 @@ badTransform: slashptr = strrchr(subCellDef->cd_file, '/'); if (slashptr != NULL) { + bool pathOK = FALSE; *slashptr = '\0'; - if (strcmp(subCellDef->cd_file, pathptr)) + /* Avoid generating error message if pathptr starts with '~' */ + /* and the tilde-expanded name matches the subCellDef name */ + + if (*pathptr == '~') + { + char *homedir = getenv("HOME"); + if (!strncmp(subCellDef->cd_file, homedir, strlen(homedir)) + && (!strcmp(subCellDef->cd_file + strlen(homedir), + pathptr + 1))) + pathOK = TRUE; + } + + if ((pathOK == FALSE) && strcmp(subCellDef->cd_file, pathptr)) { TxError("Duplicate cell in %s: Instance of cell %s is from " "path %s but cell was previously read from %s.\n",