removed previously added use_pwd_instead_of_current_dirname tcl variable: now a `.` in search path is always assumed to be [pwd] and not the directory of the currently opened schematic. This will hopefully fix an endless list of user complains when using symbols from dirs not listed in XSCHEM_LIBRARY_PATH.

This commit is contained in:
stefan schippers 2024-06-11 00:24:30 +02:00
parent 5e93182f26
commit efdb6b64ce
3 changed files with 36 additions and 57 deletions

View File

@ -2469,7 +2469,32 @@ int Tcl_AppInit(Tcl_Interp *inter)
/* SOURCE xschemrc file */
/* */
if(cli_opt_load_initfile) {
/* get xschemrc given om cmdline, in this case do *not* source any other xschemrc*/
/* get systemwide xschemrc ... */
if(tclgetvar("XSCHEM_SHAREDIR")) {
#ifndef __unix__
if (running_in_src_dir == 1) {
my_snprintf(name, S(name), "%s/../../XSchemWix/xschemrc", install_dir);
if (!stat(name, &buf)) {
fprintf(errfp, "Sourcing %s init file\n", name);
source_tcl_file(name);
}
}
else {
my_snprintf(name, S(name), "%s/xschemrc", tclgetvar("XSCHEM_SHAREDIR"));
if (!stat(name, &buf)) {
fprintf(errfp, "Tcl_AppInit(): sourcing %s\n", name);
source_tcl_file(name);
}
}
#else
my_snprintf(name, S(name), "%s/xschemrc",tclgetvar("XSCHEM_SHAREDIR"));
if(!stat(name, &buf)) {
fprintf(errfp, "Sourcing %s init file\n", name);
source_tcl_file(name);
}
#endif
}
/* get xschemrc given om cmdline */
if(cli_opt_rcfile[0]) {
my_snprintf(name, S(name), cli_opt_rcfile);
if(stat(name, &buf) ) {
@ -2480,47 +2505,22 @@ int Tcl_AppInit(Tcl_Interp *inter)
return TCL_ERROR;
}
else {
dbg(1, "Tcl_AppInit(): sourcing %s\n", name);
fprintf(errfp, "Sourcing %s init file\n", name);
source_tcl_file(name);
}
}
else {
/* get systemwide xschemrc ... */
if(tclgetvar("XSCHEM_SHAREDIR")) {
#ifndef __unix__
if (running_in_src_dir == 1) {
my_snprintf(name, S(name), "%s/../../XSchemWix/xschemrc", install_dir);
if (!stat(name, &buf)) {
dbg(1, "Tcl_AppInit(): sourcing %s\n", name);
source_tcl_file(name);
}
}
else {
my_snprintf(name, S(name), "%s/xschemrc", tclgetvar("XSCHEM_SHAREDIR"));
if (!stat(name, &buf)) {
dbg(1, "Tcl_AppInit(): sourcing %s\n", name);
source_tcl_file(name);
}
}
#else
my_snprintf(name, S(name), "%s/xschemrc",tclgetvar("XSCHEM_SHAREDIR"));
if(!stat(name, &buf)) {
dbg(1, "Tcl_AppInit(): sourcing %s\n", name);
source_tcl_file(name);
}
#endif
}
/* ... then source xschemrc in present directory if existing ... */
/* source xschemrc in present directory if existing ... */
if(!running_in_src_dir) {
my_snprintf(name, S(name), "%s/xschemrc",pwd_dir);
if(!stat(name, &buf)) {
dbg(1, "Tcl_AppInit(): sourcing %s\n", name);
fprintf(errfp, "Sourcing %s init file\n", name);
source_tcl_file(name);
} else {
/* ... or look for (user_conf_dir)/xschemrc */
my_snprintf(name, S(name), "%s/xschemrc", user_conf_dir);
if(!stat(name, &buf)) {
dbg(1, "Tcl_AppInit(): sourcing %s\n", name);
fprintf(errfp, "Sourcing %s init file\n", name);
source_tcl_file(name);
}
}

View File

@ -5871,16 +5871,9 @@ proc try_download_url {dirname sch_or_sym} {
# Example: rel_sym_path /home/schippes/share/xschem/xschem_library/devices/iopin.sym
# devices/iopin.sym
proc rel_sym_path {symbol} {
global OS pathlist use_pwd_instead_of_current_dirname
if { $use_pwd_instead_of_current_dirname != 1} {
#### consider as current directory the directory of currently loaded schematic ...
set curr_dirname [xschem get current_dirname]
} else {
#### .... or just use pwd.
set curr_dirname [pwd]
}
global OS pathlist
set curr_dirname [pwd]
set name {}
foreach path_elem $pathlist {
if { ![string compare $path_elem .] && [info exist curr_dirname]} {
@ -5913,14 +5906,9 @@ proc rel_sym_path {symbol} {
# Example: % abs_sym_path devices/iopin.sch
# /home/schippes/share/xschem/xschem_library/devices/iopin.sym
proc abs_sym_path {fname {ext {} } } {
global pathlist OS use_pwd_instead_of_current_dirname
if { $use_pwd_instead_of_current_dirname != 1} {
#### consider as current directory the directory of currently loaded schematic ...
set curr_dirname [xschem get current_dirname]
} else {
#### .... or just use pwd.
set curr_dirname [pwd]
}
global pathlist OS
set curr_dirname [pwd]
## empty: do nothing
if {$fname eq {} } return {}
## add extension for 1.0 file format compatibility
@ -5982,8 +5970,6 @@ proc abs_sym_path {fname {ext {} } } {
## if fname is present in one of the pathlist paths get the absolute path
set name {}
foreach path_elem $pathlist {
## in xschem a . in pathlist means the directory of currently loaded schematic/symbol
## or [pwd] if use_pwd_instead_of_current_dirname is set to 1
if { ![string compare $path_elem .] && [info exist curr_dirname]} {
set path_elem $curr_dirname
}
@ -6958,7 +6944,7 @@ set tctx::global_list {
text_replace_selection text_tabs_setting textwindow_fileid textwindow_filename textwindow_w
toolbar_horiz toolbar_list
toolbar_visible transparent_svg undo_type use_lab_wire unselect_partial_sel_wires
use_label_prefix use_tclreadline use_pwd_instead_of_current_dirname
use_label_prefix use_tclreadline
user_wants_copy_cell verilog_2001 verilog_bitblast viewdata_fileid viewdata_filename viewdata_w
tctx::vsize xschem_libs xschem_listen_port zoom_full_center
}
@ -8360,7 +8346,6 @@ set_ne verilog_bitblast 0
set_ne search_schematic 0
# if set to 1 search symbols (if not in any of the XSCHEM_LIBRARY_PATH directories) in [pwd]
# instead of in the directory of currently loaded schematic.
set_ne use_pwd_instead_of_current_dirname 0
set_ne split_files 0
set_ne flat_netlist 0
set_ne netlist_show 0

View File

@ -263,12 +263,6 @@
#### instead of looking only in symbol directory. Default: disabled (0).
# set search_schematic 0
#### if set to 1 search symbols (if not in any of the XSCHEM_LIBRARY_PATH directories)
#### in [pwd] instead of in the directory of currently loaded schematic.
#### default: not set (0)
# set_ne use_pwd_instead_of_current_dirname 0
#### keep symbols encountered while netlisting / descending the hierarchy.
#### Default: not enabled (0)
# set keep_symbols 0