Skip to content

Commit c61c864

Browse files
gkv311bugmaster
authored andcommitted
0031006: Draw Harness - locate_data_file fails on path containing spaces
1 parent d961951 commit c61c864

1 file changed

Lines changed: 15 additions & 14 deletions

File tree

src/DrawResources/TestCommands.tcl

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1117,34 +1117,35 @@ proc locate_data_file {filename} {
11171117

11181118
# check if the file is located in the subdirectory data of the script dir
11191119
set scriptfile [info script]
1120-
if { $scriptfile != "" } {
1121-
set path [file join [file dirname $scriptfile] data $filename]
1122-
if { [file exists $path] } {
1123-
return [file normalize $path]
1120+
if { "$scriptfile" != "" } {
1121+
set path [file join [file dirname "$scriptfile"] data "$filename"]
1122+
if { [file exists "$path"] } {
1123+
return [file normalize "$path"]
11241124
}
11251125
}
11261126

11271127
# check sub-directories in paths indicated by CSF_TestDataPath
11281128
if { [info exists env(CSF_TestDataPath)] } {
11291129
foreach dir [_split_path $env(CSF_TestDataPath)] {
1130-
while {[llength $dir] != 0} {
1131-
set name [lindex $dir 0]
1132-
set dir [lrange $dir 1 end]
1130+
set dir [list "$dir"]
1131+
while {[llength "$dir"] != 0} {
1132+
set name [lindex "$dir" 0]
1133+
set dir [lrange "$dir" 1 end]
11331134

11341135
# skip directories starting with dot
1135-
set aTail [file tail $name]
1136-
if { [regexp {^[.]} $aTail] } { continue }
1137-
if { [file exists $name/$filename] } {
1138-
return [file normalize $name/$filename]
1136+
set aTail [file tail "$name"]
1137+
if { [regexp {^[.]} "$aTail"] } { continue }
1138+
if { [file exists "$name/$filename"] } {
1139+
return [file normalize "$name/$filename"]
11391140
}
1140-
eval lappend dir [glob -nocomplain -directory $name -type d *]
1141+
eval lappend dir [glob -nocomplain -directory "$name" -type d *]
11411142
}
11421143
}
11431144
}
11441145

11451146
# check current datadir
1146-
if { [file exists [uplevel datadir]/$filename] } {
1147-
return [file normalize [uplevel datadir]/$filename]
1147+
if { [file exists "[uplevel datadir]/$filename"] } {
1148+
return [file normalize "[uplevel datadir]/$filename"]
11481149
}
11491150

11501151
# raise error

0 commit comments

Comments
 (0)