193 DefaultCommandPerMIMEPerOS at:#win32 put:(win32Commands := Dictionary new). |
193 DefaultCommandPerMIMEPerOS at:#win32 put:(win32Commands := Dictionary new). |
194 |
194 |
195 unixCommands at:'application/x-tar-compressed' put:'gunzip < %1 | tar tvf -'. |
195 unixCommands at:'application/x-tar-compressed' put:'gunzip < %1 | tar tvf -'. |
196 unixCommands at:'application/pdf' put:'acroread -display %2 %1'. |
196 unixCommands at:'application/pdf' put:'acroread -display %2 %1'. |
197 |
197 |
198 OperatingSystem isMSWINDOWSlike ifTrue:[ |
198 "/ obsolete - now read through the registry |
199 |k fkey cmd| |
199 "/ OperatingSystem isMSWINDOWSlike ifTrue:[ |
200 |
200 "/ #( |
201 k := Win32OperatingSystem::RegistryEntry key:'HKEY_CLASSES_ROOT\.pdf'. |
201 "/ "suffix" "default" "mime" |
202 k notNil ifTrue:[ |
202 "/ ( 'pdf' 'acrord32 %1' 'application/pdf' ) |
203 fkey := (k valueNamed:''). |
203 "/ ) triplesDo:[:suffix :default :mime| |
204 ]. |
204 "/ |cmd| |
205 fkey isNil ifTrue:[ |
205 "/ |
206 fkey := 'pdf_auto_file' |
206 "/ cmd := Win32OperatingSystem::RegistryEntry executableForSuffix:suffix. |
207 ]. |
207 "/ cmd isNil ifTrue:[ |
208 fkey notEmptyOrNil ifTrue:[ |
208 "/ "assume its in the path" |
209 k := Win32OperatingSystem::RegistryEntry key:('HKEY_CLASSES_ROOT\' , fkey , '\shell\open\command'). |
209 "/ cmd := default. |
210 k notNil ifTrue:[ |
210 "/ ]. |
211 cmd := k valueNamed:'' |
211 "/ win32Commands at:mime put:cmd. |
212 ]. |
212 "/ ]. |
213 ]. |
213 "/ ]. |
214 |
|
215 cmd isNil ifTrue:[ |
|
216 "assume its in the path" |
|
217 cmd := 'acrord32 %1'. |
|
218 ]. |
|
219 win32Commands at:'application/pdf' put:cmd. |
|
220 ]. |
|
221 |
214 |
222 " |
215 " |
223 self initializeDefaultCommands |
216 self initializeDefaultCommands |
224 " |
217 " |
225 |
218 |
512 ! ! |
505 ! ! |
513 |
506 |
514 !MIMETypes class methodsFor:'queries'! |
507 !MIMETypes class methodsFor:'queries'! |
515 |
508 |
516 defaultCommandForMimeType:mimeType |
509 defaultCommandForMimeType:mimeType |
517 ^ self defaultCommandPerMIME at:mimeType ifAbsent:nil. |
510 |cmd| |
|
511 |
|
512 cmd := self defaultCommandPerMIME at:mimeType ifAbsent:nil. |
|
513 cmd isNil ifTrue:[ |
|
514 OperatingSystem isMSWINDOWSlike ifTrue:[ |
|
515 cmd := Win32OperatingSystem::RegistryEntry executableForMimeType:mimeType |
|
516 ]. |
|
517 ]. |
|
518 ^ cmd |
518 |
519 |
519 " |
520 " |
520 MIMETypes defaultCommandForMimeType:'application/pdf' |
521 MIMETypes defaultCommandForMimeType:'application/pdf' |
521 " |
522 " |
522 |
523 |