improvement of previous commit. Sanitize paths ending with ////, like /aa/bb/cc///
This commit is contained in:
parent
169d743b33
commit
4fca204e8d
|
|
@ -3621,9 +3621,7 @@ proc file_dialog_getresult {loadfile confirm_overwrt} {
|
||||||
} elseif { [regexp {^/} $file_dialog_retval]} {
|
} elseif { [regexp {^/} $file_dialog_retval]} {
|
||||||
set fname $file_dialog_retval
|
set fname $file_dialog_retval
|
||||||
} else {
|
} else {
|
||||||
if {![regexp {/$} $file_dialog_dir1]} {
|
regsub {/*$} $file_dialog_dir1 {/} file_dialog_dir1
|
||||||
append file_dialog_dir1 /
|
|
||||||
}
|
|
||||||
set fname "${file_dialog_dir1}${file_dialog_retval}"
|
set fname "${file_dialog_dir1}${file_dialog_retval}"
|
||||||
}
|
}
|
||||||
if {![file exists "$fname"] } {
|
if {![file exists "$fname"] } {
|
||||||
|
|
@ -5929,9 +5927,7 @@ proc rel_sym_path {symbol} {
|
||||||
if { ![string compare $path_elem .] && [info exist curr_dirname]} {
|
if { ![string compare $path_elem .] && [info exist curr_dirname]} {
|
||||||
set path_elem $curr_dirname
|
set path_elem $curr_dirname
|
||||||
}
|
}
|
||||||
if {![regexp {/$} $path_elem]} {
|
regsub {/*$} $path_elem {/} path_elem
|
||||||
append path_elem /
|
|
||||||
}
|
|
||||||
set pl [string length $path_elem]
|
set pl [string length $path_elem]
|
||||||
if { [string equal -length $pl $path_elem $symbol] } {
|
if { [string equal -length $pl $path_elem $symbol] } {
|
||||||
set name [string range $symbol [expr {$pl}] end]
|
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]} {
|
if { ![string compare $path_elem .] && [info exist curr_dirname]} {
|
||||||
set path_elem $curr_dirname
|
set path_elem $curr_dirname
|
||||||
}
|
}
|
||||||
if {![regexp {/$} $path_elem]} {
|
regsub {/*$} $path_elem {/} path_elem
|
||||||
append path_elem /
|
|
||||||
}
|
|
||||||
set fullpath "${path_elem}${fname}"
|
set fullpath "${path_elem}${fname}"
|
||||||
if { [file exists $fullpath] } {
|
if { [file exists $fullpath] } {
|
||||||
set name $fullpath
|
set name $fullpath
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue