Search for ngsolve.tcl in PATH (after NETGENDIR)

This commit is contained in:
Matthias Hochsteger 2017-06-01 17:28:11 +02:00
parent dbee019adf
commit e68333ee00
2 changed files with 30 additions and 2 deletions

View File

@ -269,7 +269,22 @@ if { $stereo == "defined" } {
}
catch { source ${ngdir}/ngsolve.tcl }
set ngsolve_loaded 0
catch {
source ${ngdir}/ngsolve.tcl;
set ngsolve_loaded 1
}
# try to find ngsolve.tcl in PATH
set pathlist [split $::env(PATH) \ [expr {$::tcl_platform(platform) == "windows" ? ";" : ":"}]]
foreach dir $pathlist {
if { $ngsolve_loaded != 1 } {
catch {
source ${dir}/ngsolve.tcl
set ngsolve_loaded 1
}
}
}
set scriptfilename [Ng_GetCommandLineParameter script]

View File

@ -5948,7 +5948,20 @@ const char * ngscript[] = {""
,"Ng_SetVisParameters;\n"
,"redraw\n"
,"}\n"
,"catch { source ${ngdir}/ngsolve.tcl }\n"
,"set ngsolve_loaded 0\n"
,"catch {\n"
,"source ${ngdir}/ngsolve.tcl;\n"
,"set ngsolve_loaded 1\n"
,"}\n"
,"set pathlist [split $::env(PATH) \\ [expr {$::tcl_platform(platform) == \"windows\" ? \";\" : \":\"}]]\n"
,"foreach dir $pathlist {\n"
,"if { $ngsolve_loaded != 1 } {\n"
,"catch {\n"
,"source ${dir}/ngsolve.tcl\n"
,"set ngsolve_loaded 1\n"
,"}\n"
,"}\n"
,"}\n"
,"set scriptfilename [Ng_GetCommandLineParameter script]\n"
,"if { $scriptfilename != \"undefined\" } {\n"
,"if { [catch { source $scriptfilename } errstring] == 1 } {\n"