From 4fca204e8daed146dda672c47465c6af25c95543 Mon Sep 17 00:00:00 2001 From: stefan schippers Date: Tue, 12 Nov 2024 22:48:21 +0100 Subject: [PATCH] improvement of previous commit. Sanitize paths ending with ////, like /aa/bb/cc/// --- src/xschem.tcl | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/src/xschem.tcl b/src/xschem.tcl index f0dc89e4..3533a987 100644 --- a/src/xschem.tcl +++ b/src/xschem.tcl @@ -3621,9 +3621,7 @@ proc file_dialog_getresult {loadfile confirm_overwrt} { } elseif { [regexp {^/} $file_dialog_retval]} { set fname $file_dialog_retval } else { - if {![regexp {/$} $file_dialog_dir1]} { - append file_dialog_dir1 / - } + regsub {/*$} $file_dialog_dir1 {/} file_dialog_dir1 set fname "${file_dialog_dir1}${file_dialog_retval}" } if {![file exists "$fname"] } { @@ -5929,9 +5927,7 @@ proc rel_sym_path {symbol} { if { ![string compare $path_elem .] && [info exist curr_dirname]} { set path_elem $curr_dirname } - if {![regexp {/$} $path_elem]} { - append path_elem / - } + regsub {/*$} $path_elem {/} path_elem set pl [string length $path_elem] if { [string equal -length $pl $path_elem $symbol] } { set name [string range $symbol [expr {$pl}] end] @@ -6029,9 +6025,7 @@ proc abs_sym_path {fname {ext {} } } { if { ![string compare $path_elem .] && [info exist curr_dirname]} { set path_elem $curr_dirname } - if {![regexp {/$} $path_elem]} { - append path_elem / - } + regsub {/*$} $path_elem {/} path_elem set fullpath "${path_elem}${fname}" if { [file exists $fullpath] } { set name $fullpath