defaultCommandPerMIME moved from FileBrowser
authorClaus Gittinger <cg@exept.de>
Mon, 27 Jan 2003 16:46:07 +0100
changeset 1691 6ee1100ba672
parent 1690 56a73b16d62d
child 1692 eb0522e1c05a
defaultCommandPerMIME moved from FileBrowser
MIMETypes.st
--- a/MIMETypes.st	Fri Jan 24 21:48:20 2003 +0100
+++ b/MIMETypes.st	Mon Jan 27 16:46:07 2003 +0100
@@ -18,7 +18,8 @@
 	instanceVariableNames:''
 	classVariableNames:'TypeToImageReaderClassMapping FileSuffixToTypeMapping
 		FilenameToTypeMapping FileSuffixToImageReaderClassMapping
-		CharSetToFontMapping LastSuffix LastType'
+		CharSetToFontMapping LastSuffix LastType
+		DefaultCommandPerMIMEPerOS'
 	poolDictionaries:''
 	category:'System-Documentation'
 !
@@ -294,6 +295,23 @@
     "Modified: / 19.11.1999 / 15:01:53 / cg"
 !
 
+initializeDefaultCommands
+    "TODO: move this to OS"
+
+    |unixCommands win32Commands|
+
+    DefaultCommandPerMIMEPerOS := Dictionary new.
+    DefaultCommandPerMIMEPerOS at:#unix  put:(unixCommands := Dictionary new).
+    DefaultCommandPerMIMEPerOS at:#win32 put:(win32Commands := Dictionary new).
+
+    unixCommands at:'application/x-tar-compressed' put:'gunzip < %1 | tar tvf -'.
+    unixCommands at:'application/pdf'              put:'acroread -display %2 %1'.
+
+    "
+     self initializeDefaultCommands
+    "
+!
+
 miscFilenameList
     "other formats (not by suffix, but by fileName isnstead) ..."
 
@@ -457,6 +475,18 @@
     "
 !
 
+defaultCommandPerMIME
+    "TODO: move this to OS"
+
+    DefaultCommandPerMIMEPerOS isNil ifTrue:[
+        self initializeDefaultCommands
+    ].
+    OperatingSystem isUNIXlike ifTrue:[
+        ^ DefaultCommandPerMIMEPerOS at:#unix
+    ].
+    ^ DefaultCommandPerMIMEPerOS at:#win32
+!
+
 defineImageType:mimeType suffix:aSuffix reader:aReaderClass
     "register an image reader."
 
@@ -750,7 +780,7 @@
 !MIMETypes class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview2/MIMETypes.st,v 1.47 2002-12-17 14:04:25 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libview2/MIMETypes.st,v 1.48 2003-01-27 15:46:07 cg Exp $'
 ! !
 
 MIMETypes initialize!