MIMETypes.st
changeset 2096 0cc1b8dbdd5b
parent 2055 501740104b75
child 2113 65cbfeee886d
--- a/MIMETypes.st	Wed Feb 01 13:05:29 2006 +0100
+++ b/MIMETypes.st	Fri Feb 03 16:29:51 2006 +0100
@@ -195,29 +195,22 @@
     unixCommands at:'application/x-tar-compressed' put:'gunzip < %1 | tar tvf -'.
     unixCommands at:'application/pdf'              put:'acroread -display %2 %1'.
 
-    OperatingSystem isMSWINDOWSlike ifTrue:[
-        |k fkey cmd|
-
-        k := Win32OperatingSystem::RegistryEntry key:'HKEY_CLASSES_ROOT\.pdf'.
-        k notNil ifTrue:[
-            fkey := (k valueNamed:'').
-        ].
-        fkey isNil ifTrue:[
-            fkey := 'pdf_auto_file'
-        ].
-        fkey notEmptyOrNil ifTrue:[
-            k := Win32OperatingSystem::RegistryEntry key:('HKEY_CLASSES_ROOT\' , fkey , '\shell\open\command').
-            k notNil ifTrue:[
-                cmd := k valueNamed:''
-            ].
-        ].
-
-        cmd isNil ifTrue:[
-            "assume its in the path"
-            cmd := 'acrord32 %1'.
-        ].
-        win32Commands at:'application/pdf'             put:cmd.
-    ].
+    "/ 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
@@ -514,7 +507,15 @@
 !MIMETypes class methodsFor:'queries'!
 
 defaultCommandForMimeType:mimeType
-    ^ self defaultCommandPerMIME at:mimeType ifAbsent:nil.
+    |cmd|
+
+    cmd := self defaultCommandPerMIME at:mimeType ifAbsent:nil.
+    cmd isNil ifTrue:[
+        OperatingSystem isMSWINDOWSlike ifTrue:[
+            cmd := Win32OperatingSystem::RegistryEntry executableForMimeType:mimeType
+        ].
+    ].
+    ^ cmd
 
     "
      MIMETypes defaultCommandForMimeType:'application/pdf'
@@ -993,7 +994,7 @@
 !MIMETypes class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview2/MIMETypes.st,v 1.80 2005-07-27 08:31:43 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libview2/MIMETypes.st,v 1.81 2006-02-03 15:29:51 cg Exp $'
 ! !
 
 MIMETypes initialize!