Fixing bug 804.
Using function get_windows_canonical_path() may neglect the ngspice file search sequence, as an absolute path is returned also for relative input paths. ngspice however searches a file not only relative to the current directory, as inforced by this function, but for example also in the directory of the previous input file. So restrict this function to paths longer than MAX_PATH, which would fail otherwise.
This commit is contained in:
parent
86c78150b7
commit
82c620304b
|
|
@ -9844,6 +9844,10 @@ static void inp_meas_control(struct card* card)
|
|||
* might need to add the prefix separately if using the result in APIs
|
||||
* that require it for long path support.
|
||||
*
|
||||
* Using this function however may neglect the ngspice file search sequence,
|
||||
* as an absolute path is returned also for relative paths.
|
||||
* So restrict this function to paths longer than MAX_PATH.
|
||||
*
|
||||
* @param input_path The input path string (UTF-8 encoded). Can be relative or
|
||||
* absolute, may contain '.' or '..'.
|
||||
* @return char* A newly allocated UTF-8 string containing the canonical absolute
|
||||
|
|
@ -9869,6 +9873,10 @@ char* get_windows_canonical_path(const char* input_path) {
|
|||
|
||||
inputLenMB = (int)strlen(input_path);
|
||||
|
||||
/* If path length is less than MAX_PATH, just copy and return path. */
|
||||
if (inputLenMB < MAX_PATH)
|
||||
return copy(input_path);
|
||||
|
||||
if (inputLenMB == 0) {
|
||||
inputLenW = 1;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue