From 4a4091d8d3e7e8b3559d9b3b69f72b5c2020d520 Mon Sep 17 00:00:00 2001 From: stanton Date: Wed, 24 Jun 1998 16:05:34 +0000 Subject: fixed initialdir bug --- library/tkfbox.tcl | 11 +++++++++-- library/xmfbox.tcl | 9 ++++++++- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/library/tkfbox.tcl b/library/tkfbox.tcl index 31ca6f8..dc0c267 100644 --- a/library/tkfbox.tcl +++ b/library/tkfbox.tcl @@ -632,7 +632,6 @@ proc tkFDialog {args} { global tkPriv set w __tk_filedialog upvar #0 $w data - if ![string compare [lindex [info level 0] 0] tk_getOpenFile] { set type open } else { @@ -771,11 +770,19 @@ proc tkFDialog_Config {w type argList} { # settings # if [string compare $data(-initialdir) ""] { + if [file isdirectory $data(-initialdir)] { set data(selectPath) [glob $data(-initialdir)] } else { - error "\"$data(-initialdir)\" is not a valid directory" + set data(selectPath) [pwd] } + + # Convert the initialdir to an absolute path name. + + set old [pwd] + cd $data(selectPath) + set data(selectPath) [pwd] + cd $old } set data(selectFile) $data(-initialfile) diff --git a/library/xmfbox.tcl b/library/xmfbox.tcl index 52f8b33..361f08a 100644 --- a/library/xmfbox.tcl +++ b/library/xmfbox.tcl @@ -145,8 +145,15 @@ proc tkMotifFDialog_Config {w type argList} { if [file isdirectory $data(-initialdir)] { set data(selectPath) [glob $data(-initialdir)] } else { - error "\"$data(-initialdir)\" is not a valid directory" + set data(selectPath) [pwd] } + + # Convert the initialdir to an absolute path name. + + set old [pwd] + cd $data(selectPath) + set data(selectPath) [pwd] + cd $old } set data(selectFile) $data(-initialfile) -- cgit v0.12