Added code to EFread to make sure that reading .ext files is

symmetric with writing them.  Since the writing of .ext files
was changed to preferably use the location of the cell being
read, and since the extflat database does not save this path
information, it was necessary to check the main database entry
for each cell to determine if there is a non-default path where
the .ext file may have been saved (with the current working
directory used as a fall-back if the directory is not writeable).
This commit is contained in:
Tim Edwards 2018-09-25 14:19:30 -04:00
parent d594ba8e07
commit ca67c8aedf
1 changed files with 23 additions and 2 deletions

View File

@ -172,12 +172,13 @@ efReadDef(def, dosubckt, resist, noscale, toplevel)
bool dosubckt, resist, noscale, toplevel;
{
int argc, ac, n;
CellDef *dbdef;
EFCapValue cap;
char line[1024], *argv[64], *name, *attrs;
int rscale = 1; /* Multiply resistances by this */
int cscale = 1; /* Multiply capacitances by this */
float lscale = 1.0; /* Multiply lambda by this */
FILE *inf;
FILE *inf = NULL;
Use *use;
Rect r;
bool rc = TRUE;
@ -187,7 +188,27 @@ efReadDef(def, dosubckt, resist, noscale, toplevel)
/* Mark def as available */
def->def_flags |= DEF_AVAILABLE;
name = def->def_name;
inf = PaOpen(name, "r", ".ext", EFSearchPath, EFLibPath, &efReadFileName);
/* If cell is in main database, check if there is a file path set. */
if ((dbdef = DBCellLookDef(name)) != NULL)
{
if (dbdef->cd_file != NULL)
{
char *filepath, *sptr;
filepath = StrDup((char **)NULL, dbdef->cd_file);
sptr = strrchr(filepath, '/');
if (sptr) {
*sptr = '\0';
inf = PaOpen(name, "r", ".ext", filepath, EFLibPath, &efReadFileName);
}
freeMagic(filepath);
}
}
if (inf == NULL)
inf = PaOpen(name, "r", ".ext", EFSearchPath, EFLibPath, &efReadFileName);
if (inf == NULL)
{
/* Complementary to .ext file write: If file is in a read-only */