@@ -88,13 +88,11 @@ namespace eval ::support {
8888 # Detect temporary directory.
8989 variable TEMP_DIR [file join [::support::utils::get_temp_dir] " temp-support-[ pid ] " ]
9090 if {![file exists $TEMP_DIR ]} {
91- if [catch {file mkdir $TEMP_DIR }] {
92- puts " ERROR: Didn't find temporary directory"
93- puts " ERROR: Couldn't make temporary directory \" $TEMP_DIR \" "
91+ if {[catch {file mkdir $TEMP_DIR }]} {
92+ puts " ERROR: The temporary directory \" $TEMP_DIR \" was not created!"
9493 }
9594 } elseif {![file isdirectory $TEMP_DIR ]} {
96- puts " ERROR: Didn't find temporary directory"
97- puts " ERROR: Temporary directory \" $TEMP_DIR \" exists, and is not a directory"
95+ puts " ERROR: The temporary directory \" $TEMP_DIR \" is not a directory!"
9896 }
9997
10098 # Print some informations.
@@ -310,6 +308,19 @@ proc exit {} {
310308 if {$::support::CONNECTED == 1} {
311309 ::support::disconnect 1
312310 }
313- file delete -force $::support::TEMP_DIR
311+
312+ # Remove temporary files explicitly.
313+ foreach f [::support::utils::get_files $::support::TEMP_DIR ] {
314+ if {[file isfile $f ] && [catch {file delete -force $f }]} {
315+ puts " WARNING: Can't remove temporary file \" $f \" !"
316+ puts $::errorInfo
317+ }
318+ }
319+
320+ # Remove temporary folder recursively.
321+ if {[catch {file delete -force $::support::TEMP_DIR }]} {
322+ puts " WARNING: Can't cleanup temporary directory \" $::support::TEMP_DIR \" !"
323+ puts $::errorInfo
324+ }
314325 __exit
315326}
0 commit comments