diff options
-rw-r--r-- | library/tkfbox.tcl | 11 | ||||
-rw-r--r-- | 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) |