From: abv Date: Thu, 1 Nov 2012 12:14:06 +0000 (+0400) Subject: 0023275: restore command set name of result variable incorrectly if absolute path... X-Git-Tag: V6_5_4~11 X-Git-Url: http://git.dev.opencascade.org/gitweb/?a=commitdiff_plain;h=1598ec0e46e8b807166f382a32bf47fc2d7b1219;p=occt-copy.git 0023275: restore command set name of result variable incorrectly if absolute path is used Command restore corrected to set default name of the shape equal to filename without extension Test case added (demo draw restore) --- diff --git a/src/DrawResources/StandardCommands.tcl b/src/DrawResources/StandardCommands.tcl index 1d16b4bb7a..7a4f654889 100755 --- a/src/DrawResources/StandardCommands.tcl +++ b/src/DrawResources/StandardCommands.tcl @@ -281,7 +281,10 @@ proc save {name {file ""}} { help save {save variable [filename]} "DRAW Variables management" proc restore {file {name ""}} { - if {$name == ""} {set name $file} + if {$name == ""} { + # if name is not given explicitly, use name of the file w/o extension + set name [file rootname [file tail $file]] + } global Draw_DataDir uplevel #0 "brestore [file join $Draw_DataDir $file ] $name" return $name diff --git a/tests/demo/draw/restore b/tests/demo/draw/restore new file mode 100644 index 0000000000..5ac560ceae --- /dev/null +++ b/tests/demo/draw/restore @@ -0,0 +1,10 @@ +# check that restore command defines default name for the loaded shape +# as base name of the file without extension + +restore [locate_data_file CCV-POUR-COPIER-COLLER.brep] + +if { ! [regexp {is a shape} [whatis CCV-POUR-COPIER-COLLER]] } { + puts "Error: no shape with name CCV-POUR-COPIER-COLLER after restore" +} + +puts "TEST COMPLETED"