Now trap nonexistent paths in save dialog.

If current-dir doesn't exist on reopen of dialog, the bonafide
current directory is used.

Checkbox for dotfiles now initialized.

original commit: 77ca877d64188427de3387e220723d2128339336
This commit is contained in:
Paul Steckler 1998-02-19 18:24:59 +00:00
parent f0059a9c1b
commit a9380cf720

View File

@ -103,7 +103,9 @@
(private
[set-directory ; sets directory in listbox
(lambda (dir) ; dir is normalized
(when (directory-exists? dir)
(mred:gui-utils:show-busy-cursor
(lambda ()
(set! current-dir dir)
@ -113,7 +115,8 @@
(let loop ([this-dir dir]
[dir-list ()]
[menu-list ()])
(let-values ([(base-dir in-dir dir?) (split-path this-dir)])
(let-values ([(base-dir in-dir dir?)
(split-path this-dir)])
(if (eq? wx:platform 'windows)
(mzlib:string:string-lowercase! in-dir))
(let* ([dir-list (cons this-dir dir-list)]
@ -134,7 +137,8 @@
(send name-list clear)
(send name-list set
(mzlib:function:quicksort
(let ([no-periods? (not (mred:preferences:get-preference
(let ([no-periods?
(not (mred:preferences:get-preference
'mred:show-periods-in-dirlist))])
(let loop ([l (directory-list dir)])
(if (null? l)
@ -150,12 +154,13 @@
(cons (string-append s (get-slash))
rest)]
[(or (not file-filter)
(mzlib:string:regexp-match-exact? file-filter s))
(mzlib:string:regexp-match-exact?
file-filter s))
(cons s rest)]
[else rest])))))
(if (eq? wx:platform 'unix) string<? string-ci<?)))
(send name-list set-selection-and-edit 0)
(set! last-selected -1))))]
(set! last-selected -1)))))]
[set-edit
(lambda ()
@ -175,7 +180,9 @@
[show
(lambda (b)
(when b
(set-directory current-dir))
(if (directory-exists? current-dir)
(set-directory current-dir)
(set-directory (current-directory))))
(super-show b))]
[do-period-in/exclusion
@ -273,10 +280,21 @@
"Warning"
wx:const-yes-no)
wx:const-yes))
(begin
(set-box!
result-box (mzlib:file:normalize-path file))
(show #f)))))))]))))]
(let ([normal-path
(with-handlers
([(lambda (_) #t)
(lambda (_)
(wx:message-box
(string-append
"The file "
file
" contains nonexistent directory or cycle.")
"Warning")
#f)])
(mzlib:file:normalize-path file))])
(when normal-path
(set-box! result-box normal-path)
(show #f))))))))]))))]
[add-one
(lambda (name)
@ -517,10 +535,14 @@
(sequence
(when (eq? wx:platform 'unix)
(make-object mred:container:check-box% dot-panel
(let ([dot-cb
(make-object
mred:container:check-box% dot-panel
do-period-in/exclusion
"Show files and directories that begin with a dot")
(send dot-panel stretchable-in-y #f))
"Show files and directories that begin with a dot")])
(send dot-panel stretchable-in-y #f)
(send dot-cb set-value
(mred:preferences:get-preference 'mred:show-periods-in-dirlist))))
(send directory-panel stretchable-in-y #f)