Revised the file opening routine with respect to the search paths.
Previously, a file path beginning with "/", "./", or "../" would be searched for verbatim and no searching would be done over paths. This behavior now occurs for a leading "/" only. File paths with "./" or "../" will search for the file with the path verbatim, then proceed to search for the file with each search path prepended to the filename as usual. This solves a problem for reusable, non- PDK IP blocks, where the IP block may have an abstract view pointing to a GDS file which is specified as being located at "../gds/<file>". This file would not be found if the IP block was included into another project. Now it can be done if the path to the IP is given by "addpath".
This commit is contained in:
parent
f3bfde60f0
commit
0c36365db8
13
utils/path.c
13
utils/path.c
|
|
@ -736,8 +736,9 @@ PaLockOpen(file, mode, ext, path, library, pRealName, is_locked, fdp)
|
|||
#endif
|
||||
f = fopen(realName, mode);
|
||||
|
||||
if ((fdp != NULL) && (f != NULL)) *fdp = fileno(f);
|
||||
return f;
|
||||
if ((fdp != NULL) && (f != NULL)) *fdp = fileno(f);
|
||||
if ((f != NULL) || (file[0] == '/'))
|
||||
return f;
|
||||
}
|
||||
|
||||
/* Now try going through the path, one entry at a time. */
|
||||
|
|
@ -883,9 +884,15 @@ PaZOpen(file, mode, ext, path, library, pRealName)
|
|||
|| strcmp(file, "..") == 0
|
||||
|| strncmp(file, "../", 3) == 0)))
|
||||
{
|
||||
gzFile result;
|
||||
(void) strncpy(realName, file, MAXSIZE-1);
|
||||
realName[MAXSIZE-1] = '\0';
|
||||
return gzopen(realName, mode);
|
||||
|
||||
/* For full paths, halt immediately if not found. Otherwise,
|
||||
* treat the path as relative to something in the search path.
|
||||
*/
|
||||
result = gzopen(realName, mode);
|
||||
if ((result != NULL) || (file[0] == '/')) return result;
|
||||
}
|
||||
|
||||
/* Now try going through the path, one entry at a time. */
|
||||
|
|
|
|||
Loading…
Reference in New Issue