more on recognizing web urls

This commit is contained in:
Stefan Frederik 2022-11-13 10:59:36 +01:00
parent 94247770ce
commit 349bebda20
2 changed files with 9 additions and 3 deletions

View File

@ -2425,7 +2425,10 @@ int Tcl_AppInit(Tcl_Interp *inter)
char f[PATH_MAX];
#ifdef __unix__
if(cli_opt_filename[0] == '~' && cli_opt_filename[1] == '/') {
if(strstr(cli_opt_filename, "http://") == cli_opt_filename ||
strstr(cli_opt_filename, "https://") == cli_opt_filename) {
my_snprintf(f, S(f), "%s", cli_opt_filename);
} else if(cli_opt_filename[0] == '~' && cli_opt_filename[1] == '/') {
my_snprintf(f, S(f), "%s%s", home_dir, cli_opt_filename + 1);
} else if(cli_opt_filename[0] == '.' && cli_opt_filename[1] == '/') {
my_snprintf(f, S(f), "%s%s", pwd_dir, cli_opt_filename + 1);

View File

@ -2497,7 +2497,7 @@ proc load_file_dialog_up {dir} {
proc myload_getresult {loadfile confirm_overwrt} {
global myload_dir1 myload_retval myload_ext
if { $myload_retval ne {}} {
if { [regexp {^http[s]?://} $myload_retval] } {
if { [regexp {^https?://} $myload_retval] } {
set fname $myload_retval
} elseif { [regexp {^/} $myload_retval]} {
set fname $myload_retval
@ -4456,7 +4456,6 @@ proc rel_sym_path {symbol} {
## given a library/symbol return its absolute path
proc abs_sym_path {fname {ext {} } } {
global pathlist OS
set curr_dirname [xschem get current_dirname]
## empty: do nothing
if {$fname eq {} } return {}
@ -4464,6 +4463,10 @@ proc abs_sym_path {fname {ext {} } } {
if { $ext ne {} } {
set fname [file rootname $fname]$ext
}
# web url: return as is
if { [regexp {^https?://} $fname]} {
return "$fname"
}
if {$OS eq "Windows"} {
## absolute path: return as is
if { [regexp {^[A-Za-z]\:/} $fname ] } {