Skip to content

Commit 0c36365

Browse files
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".
1 parent f3bfde6 commit 0c36365

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

VERSION

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
8.3.488
1+
8.3.489

utils/path.c

+10-3
Original file line numberDiff line numberDiff line change
@@ -736,8 +736,9 @@ PaLockOpen(file, mode, ext, path, library, pRealName, is_locked, fdp)
736736
#endif
737737
f = fopen(realName, mode);
738738

739-
if ((fdp != NULL) && (f != NULL)) *fdp = fileno(f);
740-
return f;
739+
if ((fdp != NULL) && (f != NULL)) *fdp = fileno(f);
740+
if ((f != NULL) || (file[0] == '/'))
741+
return f;
741742
}
742743

743744
/* Now try going through the path, one entry at a time. */
@@ -883,9 +884,15 @@ PaZOpen(file, mode, ext, path, library, pRealName)
883884
|| strcmp(file, "..") == 0
884885
|| strncmp(file, "../", 3) == 0)))
885886
{
887+
gzFile result;
886888
(void) strncpy(realName, file, MAXSIZE-1);
887889
realName[MAXSIZE-1] = '\0';
888-
return gzopen(realName, mode);
890+
891+
/* For full paths, halt immediately if not found. Otherwise,
892+
* treat the path as relative to something in the search path.
893+
*/
894+
result = gzopen(realName, mode);
895+
if ((result != NULL) || (file[0] == '/')) return result;
889896
}
890897

891898
/* Now try going through the path, one entry at a time. */

0 commit comments

Comments
 (0)