use lastFileSelection if requesting a file without given dir,
and default is '*.*'.
--- a/DialogBox.st Tue Jun 16 15:11:34 1998 +0200
+++ b/DialogBox.st Tue Jun 16 16:40:20 1998 +0200
@@ -1764,11 +1764,11 @@
Return the string or the value of failBlock if cancel was pressed.
The version argument allows validation of the files existance;
it may be any of:
- #mustBeNew - fail (return empty string) if the file exists
- #new - confirm if the file exists
- #mustBeOld - fail if the file does not exist
- #old - confirm if the file does not exist
- #any (other) - no validation
+ #mustBeNew - fail (return empty string) if the file exists
+ #new - confirm if the file exists
+ #mustBeOld - fail if the file does not exist
+ #old - confirm if the file does not exist
+ #any (other) - no validation
"
|box defaultDir defaultNm|
@@ -1776,10 +1776,15 @@
defaultNm := defaultName.
defaultDir := aDirectoryPath.
defaultDir isNil ifTrue:[
- defaultNm notNil ifTrue:[
- defaultDir := defaultName asFilename directoryName.
- defaultNm := defaultNm asFilename baseName.
- ].
+ defaultNm notNil ifTrue:[
+ defaultName asFilename withoutSuffix baseName = '*' ifTrue:[
+ defaultDir := FileSelectionBox lastFileSelectionDirectory.
+ defaultNm := ''.
+ ] ifFalse:[
+ defaultDir := defaultName asFilename directoryName.
+ defaultNm := defaultNm asFilename baseName.
+ ]
+ ].
].
box := FileSelectionBox title:titleString.
@@ -1787,29 +1792,30 @@
pattern notNil ifTrue:[box pattern:pattern].
box initialText:defaultNm.
box action:[:name |
- versionSymbol == #mustBeNew ifTrue:[
- "/ file may not exist
- name asFilename exists ifTrue:[^ ''].
- ].
- versionSymbol == #new ifTrue:[
- "/ file may not exist
- name asFilename exists ifTrue:[
- (self confirm:(self classResources string:'''%1'' exists.\\Continue anyway ?' with:box fileName) withCRs)
- ifFalse:[^ ''].
- ].
- ].
- versionSymbol == #mustBeOld ifTrue:[
- name asFilename exists ifFalse:[^ ''].
- ].
- versionSymbol == #old ifTrue:[
- "/ file may not exist
- name asFilename exists ifFalse:[
- (self confirm:(self classResources string:'''%1'' does not exist yet.\\Continue anyway ?' with:box fileName) withCRs)
- ifFalse:[^ ''].
- ].
- ].
- box destroy.
- ^ name
+ versionSymbol == #mustBeNew ifTrue:[
+ "/ file may not exist
+ name asFilename exists ifTrue:[^ ''].
+ ].
+ versionSymbol == #new ifTrue:[
+ "/ file may not exist
+ name asFilename exists ifTrue:[
+ (self confirm:(self classResources string:'''%1'' exists.\\Continue anyway ?' with:box fileName) withCRs)
+ ifFalse:[^ ''].
+ ].
+ ].
+ versionSymbol == #mustBeOld ifTrue:[
+ name asFilename exists ifFalse:[^ ''].
+ ].
+ versionSymbol == #old ifTrue:[
+ "/ file may not exist
+ name asFilename exists ifFalse:[
+ (self confirm:(self classResources string:'''%1'' does not exist yet.\\Continue anyway ?' with:box fileName) withCRs)
+ ifFalse:[^ ''].
+ ].
+ ].
+ FileSelectionBox lastFileSelectionDirectory:box directory.
+ box destroy.
+ ^ name
].
box showAtPointer.
box action:nil.
@@ -1818,35 +1824,35 @@
"
Dialog
- requestFileName:'enter a fileName:'
- default:''
- version:nil
- ifFail:['none']
- pattern:'*.conf'
- fromDirectory:'/etc'
+ requestFileName:'enter a fileName:'
+ default:''
+ version:nil
+ ifFail:['none']
+ pattern:'*.conf'
+ fromDirectory:'/etc'
"
"
Dialog
- requestFileName:'enter a fileName:'
- default:''
- version:#old
- ifFail:['none']
- pattern:'*.conf'
- fromDirectory:'/etc'
+ requestFileName:'enter a fileName:'
+ default:''
+ version:#old
+ ifFail:['none']
+ pattern:'*.conf'
+ fromDirectory:'/etc'
"
"
Dialog
- requestFileName:'enter a fileName:'
- default:''
- version:#mustBeNew
- ifFail:['none']
- pattern:'*.conf'
- fromDirectory:'/etc'
- "
-
- "Modified: 20.2.1997 / 18:12:28 / cg"
- "Created: 21.2.1997 / 14:23:44 / stefan"
- "Modified: 21.2.1997 / 14:38:04 / stefan"
+ requestFileName:'enter a fileName:'
+ default:''
+ version:#mustBeNew
+ ifFail:['none']
+ pattern:'*.conf'
+ fromDirectory:'/etc'
+ "
+
+ "Created: / 21.2.1997 / 14:23:44 / stefan"
+ "Modified: / 21.2.1997 / 14:38:04 / stefan"
+ "Modified: / 16.6.1998 / 13:34:23 / cg"
!
requestFileName:titleString ifFail:cancelBlock
@@ -5653,6 +5659,6 @@
!DialogBox class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libwidg/DialogBox.st,v 1.113 1998-06-16 10:37:19 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libwidg/DialogBox.st,v 1.114 1998-06-16 14:40:20 cg Exp $'
! !
DialogBox initialize!