From b24c9ed7631c2cce1077abe2a00a6b16db25a28f Mon Sep 17 00:00:00 2001 From: Stefan Schippers Date: Mon, 26 Oct 2020 02:31:47 +0100 Subject: [PATCH] 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. --- src/save.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/save.c b/src/save.c index f79d45be..9664ef81 100644 --- a/src/save.c +++ b/src/save.c @@ -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);