If opening a non existing xxxx.sym file euristically set netlist_type to symbol --> better implementation

This commit is contained in:
stefan schippers 2025-01-21 04:09:08 +01:00
parent d47747965f
commit 2b05b365e5
1 changed files with 1 additions and 3 deletions

View File

@ -3524,7 +3524,6 @@ int load_schematic(int load_symbols, const char *fname, int reset_undo, int aler
else fd=fopen(name,fopen_read_mode); else fd=fopen(name,fopen_read_mode);
if( fd == NULL) { if( fd == NULL) {
size_t len; size_t len;
char *ptr;
ret = 0; ret = 0;
if(alert) { if(alert) {
fprintf(errfp, "load_schematic(): unable to open file: %s, fname=%s\n", name, fname ); fprintf(errfp, "load_schematic(): unable to open file: %s, fname=%s\n", name, fname );
@ -3534,8 +3533,7 @@ int load_schematic(int load_symbols, const char *fname, int reset_undo, int aler
} }
} }
len = strlen(name); len = strlen(name);
ptr = strstr(name, ".sym"); if(!strcmp(name + len - 4, ".sym")) {
if(ptr && ptr - name == len - 4) {
xctx->save_netlist_type = xctx->netlist_type; xctx->save_netlist_type = xctx->netlist_type;
xctx->netlist_type = CAD_SYMBOL_ATTRS; xctx->netlist_type = CAD_SYMBOL_ATTRS;
set_tcl_netlist_type(); set_tcl_netlist_type();