get_trailing_path(): do not confuse generator extension with schematic/symbol extension

This commit is contained in:
stefan schippers 2023-05-10 04:08:47 +02:00
parent 7ad930e7f0
commit 1e74b21c49
2 changed files with 8 additions and 4 deletions

View File

@ -1132,7 +1132,7 @@ const char *get_trailing_path(const char *str, int no_of_dir, int skip_ext)
static char s[PATH_MAX]; /* safe to keep even with multiple schematic windows */
size_t len;
size_t ext_pos, dir_pos;
int n_ext, n_dir, c, i;
int n_ext, n_dir, c, i, generator = 0;
if(str == NULL) return NULL;
my_strncpy(s, str, S(s));
@ -1140,8 +1140,12 @@ const char *get_trailing_path(const char *str, int no_of_dir, int skip_ext)
for(ext_pos=len, dir_pos=len, n_ext=0, n_dir=0, i=(int)len; i>=0; i--) {
c = s[i];
if(c=='.' && ++n_ext==1) ext_pos = i;
if(c=='.' && ++n_ext == 1) {
if(!generator) ext_pos = i;
if(generator) s[i] = '_';
}
if(c=='/' && ++n_dir==no_of_dir+1) dir_pos = i;
if(c=='(') generator = 1;
}
if(skip_ext) s[ext_pos] = '\0';

View File

@ -73,11 +73,11 @@ N 470 -640 520 -640 {
lab=IN}
N 600 -640 660 -640 {
lab=IN_BUF3}
C {symbolgen.tcl(inv, @ROUT )} 150 -460 0 0 {name=x1
C {symbolgen.tcl(inv,@ROUT\\)} 150 -460 0 0 {name=x1
tclcommand="edit_file [abs_sym_path symbolgen.tcl]"
ROUT=1200}
C {lab_pin.sym} 30 -520 0 0 {name=p1 lab=IN}
C {symbolgen.tcl(buf, @ROUT )} 150 -560 0 0 {name=x3
C {symbolgen.tcl(buf,@ROUT\\)} 150 -560 0 0 {name=x3
tclcommand="edit_file [abs_sym_path symbolgen.tcl]"
ROUT=1200}
C {lab_pin.sym} 310 -560 0 1 {name=p2 lab=IN_BUF}