fix an issue if "xschem ./sch_file.sch" is given on commandline, in this case load_file() will set current_dirname to /some/path/., this confuses abs_sym_path, so remove trailing /. in this case.

This commit is contained in:
Stefan Schippers 2020-10-26 02:31:47 +01:00
parent 24370cb752
commit b24c9ed763
1 changed files with 2 additions and 1 deletions

View File

@ -980,7 +980,8 @@ void load_schematic(int load_symbols, const char *filename, int reset_undo) /* 2
if(filename && filename[0]) {
my_strncpy(name, filename, S(name));
my_strncpy(xctx->sch[xctx->currsch], name, S(xctx->sch[xctx->currsch]));
my_snprintf(msg, S(msg), "set current_dirname \"[file dirname {%s}]\"", name);
/* if current_dirname is /some/path/. remove /. at end */
my_snprintf(msg, S(msg), "set current_dirname \"[regsub {/\\.$} [file dirname {%s}] {}]\"", name);
tcleval(msg);
my_strncpy(xctx->current_name, rel_sym_path(name), S(xctx->current_name));
dbg(1, "load_schematic(): opening file for loading:%s, filename=%s\n", name, filename);