From 1c7f2356e07d988d62a62cd43f9b2c055efb23ee Mon Sep 17 00:00:00 2001 From: Joachim Schoeberl Date: Fri, 8 May 2009 14:56:41 +0000 Subject: [PATCH] does not try to create ini file if there is no write permission --- ng/nghelp.tcl | 2 +- ng/variables.tcl | 30 +++++++++++++++++------------- 2 files changed, 18 insertions(+), 14 deletions(-) diff --git a/ng/nghelp.tcl b/ng/nghelp.tcl index e13ab7c3..3d4191f7 100644 --- a/ng/nghelp.tcl +++ b/ng/nghelp.tcl @@ -187,7 +187,7 @@ set_control_help $f.first "First step in mesh generation. Usually, meshing star set_control_help $f.last "Last step in mesh generation. If only the surface mesh is required, please set \"Last Step\" to \"Optimize Surface\"" set_control_help .bubar.surfm "Start mesh generation" -set_control_help .bubar.stopm "Start mesh generation" +set_control_help .bubar.stopm "Stop mesh generation" proc help_item { helptext } {p puts $helptext diff --git a/ng/variables.tcl b/ng/variables.tcl index a8c1ca9b..a11ef096 100644 --- a/ng/variables.tcl +++ b/ng/variables.tcl @@ -623,15 +623,17 @@ proc saveoptions { } { -# the ini file is save on demand : +# the ini file is saved on demand : proc saveinifile { } { uplevel 1 { - set datei [open ng.ini w] - for { set i [.ngmenu.file.recent index last] } { $i >= 1 } { incr i -1 } { - puts $datei "recentfile \"[.ngmenu.file.recent entrycget $i -label]\"" - } - - close $datei + if {[catch { set datei [open ng.ini w] } result ]} { + puts "cannot write to ng.ini file" + } { + for { set i [.ngmenu.file.recent index last] } { $i >= 1 } { incr i -1 } { + puts $datei "recentfile \"[.ngmenu.file.recent entrycget $i -label]\"" + } + close $datei + } } @@ -641,12 +643,14 @@ proc saveinifile { } { proc savemeshinifile { } { uplevel 1 { - set datei [open ngmesh.ini w] - for { set i [.ngmenu.file.recentmesh index last] } { $i >= 1 } { incr i -1 } { - puts $datei "recentfile \"[.ngmenu.file.recentmesh entrycget $i -label]\"" - } - - close $datei + if {[catch { set datei [open ngmesh.ini w] } result } { + puts "cannot write to ng.ini file" + } { + for { set i [.ngmenu.file.recentmesh index last] } { $i >= 1 } { incr i -1 } { + puts $datei "recentfile \"[.ngmenu.file.recentmesh entrycget $i -label]\"" + } + close $datei + } }