class: MIMETypes
authorClaus Gittinger <cg@exept.de>
Tue, 01 Oct 2013 15:24:25 +0200
changeset 3253 32a605517d3d
parent 3252 974b0b2d3001
child 3254 8c2680e496c9
class: MIMETypes changed: #initializeDefaultCommands
MIMETypes.st
--- a/MIMETypes.st	Tue Sep 24 23:35:10 2013 +0200
+++ b/MIMETypes.st	Tue Oct 01 15:24:25 2013 +0200
@@ -216,7 +216,7 @@
 initializeDefaultCommands
     "TODO: move this to OS"
 
-    |unixCommands win32Commands unixPrintCommands win32PrintCommands|
+    |unixCommands win32Commands unixPrintCommands win32PrintCommands listToTry|
 
     DefaultCommandPerMIMEPerOS := Dictionary new.
     DefaultCommandPerMIMEPerOS at:#unix  put:(unixCommands := Dictionary new).
@@ -225,17 +225,27 @@
     unixCommands at:'application/x-tar-compressed' put:'tar tvf -'.
 
     OperatingSystem isMSWINDOWSlike ifFalse:[ |cmd|
-        cmd := #('firefox' 'chrome' 'chromium' 'konqueror' 'opera')
-                detect:[:aCmd| (OperatingSystem pathOfCommand:aCmd) notEmptyOrNil ]
-                ifNone:nil.
+        OperatingSystem isOSXlike ifTrue:[
+            listToTry := #( '/Applications/Safari.app/Contents/MacOS/Safari' )
+        ] ifFalse:[
+            listToTry := #('firefox' 'chrome' 'chromium' 'konqueror' 'opera')
+        ].
+        cmd := listToTry
+                    detect:[:aCmd| (OperatingSystem pathOfCommand:aCmd) notEmptyOrNil ]
+                    ifNone:nil.
 
         cmd notNil ifTrue:[
             unixCommands at:'text/html' put:(cmd, ' "%1"')       
         ].
 
-        cmd := #('acroread' 'okular' 'evince' 'kpdf' 'xpdf')
-                detect:[:aCmd| (OperatingSystem pathOfCommand:aCmd) notEmptyOrNil ]
-                ifNone:nil.
+        OperatingSystem isOSXlike ifTrue:[
+            listToTry := #( '/Applications/Preview.app/Contents/MacOS/Preview' )
+        ] ifFalse:[
+            listToTry := #('acroread' 'okular' 'evince' 'kpdf' 'xpdf')
+        ].
+        cmd := listToTry
+                    detect:[:aCmd| (OperatingSystem pathOfCommand:aCmd) notEmptyOrNil ]
+                    ifNone:nil.
 
         cmd notNil ifTrue:[
             unixCommands at:'application/pdf' put:(cmd, ' "%1"')       
@@ -252,23 +262,6 @@
     "/ if not, you may need more...
     "/ unixPrintCommands at:'application/pdf'         put:'pdfToPS %1 | lpr'.
 
-    "/ WIN32 setup is now obsolete - now read through the registry
-"/    OperatingSystem isMSWINDOWSlike ifTrue:[
-"/        #(
-"/            "suffix"    "default"       "mime"
-"/            ( 'pdf'     'acrord32 %1'   'application/pdf' )
-"/        ) triplesDo:[:suffix :default :mime|
-"/            |cmd|
-"/
-"/            cmd := Win32OperatingSystem::RegistryEntry executableForSuffix:suffix.
-"/            cmd isNil ifTrue:[
-"/                "assume its in the path"
-"/                cmd := default.
-"/            ].
-"/            win32Commands at:mime put:cmd.
-"/        ].
-"/    ].
-
     "
      self initializeDefaultCommands
     "
@@ -1352,11 +1345,11 @@
 !MIMETypes class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview2/MIMETypes.st,v 1.129 2013-08-02 15:55:30 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libview2/MIMETypes.st,v 1.130 2013-10-01 13:24:25 cg Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libview2/MIMETypes.st,v 1.129 2013-08-02 15:55:30 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libview2/MIMETypes.st,v 1.130 2013-10-01 13:24:25 cg Exp $'
 ! !