improvement of previous commit. Sanitize paths ending with ////, like /aa/bb/cc///

This commit is contained in:
stefan schippers 2024-11-12 22:48:21 +01:00
parent 169d743b33
commit 4fca204e8d
1 changed files with 3 additions and 9 deletions

View File

@ -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