#FEATURE
class: AbstractFileBrowser
comment/format in: #fileMenu
changed:
#askForCommandFor:thenDo:
#initialCommandFor:in:intoBox:
remember per-suffix file open command
--- a/AbstractFileBrowser.st Sun Mar 13 00:30:11 2016 +0100
+++ b/AbstractFileBrowser.st Sun Mar 20 11:13:59 2016 +0100
@@ -360,6 +360,12 @@
baseName := path baseName.
suffix := path suffix.
+ cmd := UserPreferences current defaultFileOpenCommandFor:suffix.
+ cmd notNil ifTrue:[
+ aBox initialText:(cmd bindWith:fileName pathName).
+ ^ self
+ ].
+
mime := MIMETypes mimeTypeForSuffix:suffix.
"/ mime notNil ifTrue:[
"/ cmd := self initialCommandForMIME:mime file:path
@@ -2988,7 +2994,7 @@
"setup and launch a querybox to ask for a unix command.
Then evaluate aBlock passing the command-string as argument."
- |box osName commandString|
+ |box osName commandString alwaysOpenLikeThisHolder openCmd suffix|
osName := OperatingSystem platformName.
@@ -3000,10 +3006,19 @@
fileName notNil ifTrue:[
self initialCommandFor:fileName into:box.
].
+ alwaysOpenLikeThisHolder := false asValue.
+ box verticalPanel add:((CheckBox label:'Always use this command for this file type') model:alwaysOpenLikeThisHolder).
box directory:(self getDirWithoutFileName:fileName).
- box show.
- box destroy.
-
+ box open.
+
+ "/ box destroy.
+ alwaysOpenLikeThisHolder value ifTrue:[
+ openCmd := commandString upTo:$".
+ suffix := fileName suffix.
+ UserPreferences current defaultFileOpenCommandFor:suffix put:(openCmd,' "%1"').
+ self halt.
+ ].
+
commandString notNil ifTrue:[
aBlock value:commandString
].