does not try to create ini file if there is no write permission

This commit is contained in:
Joachim Schoeberl 2009-05-08 14:56:41 +00:00
parent b8d71dd7a5
commit 1c7f2356e0
2 changed files with 18 additions and 14 deletions

View File

@ -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

View File

@ -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
}
}