author | Claus Gittinger <cg@exept.de> |
Sun, 09 Nov 2014 23:17:21 +0100 | |
changeset 3380 | e7a59408d31a |
parent 3367 | 048fc9f61885 |
child 3400 | 7c44ae7a6d6b |
permissions | -rw-r--r-- |
643 | 1 |
" |
2 |
COPYRIGHT (c) 1997 by eXept Software AG |
|
1612 | 3 |
All Rights Reserved |
643 | 4 |
|
5 |
This software is furnished under a license and may be used |
|
6 |
only in accordance with the terms of that license and with the |
|
7 |
inclusion of the above copyright notice. This software may not |
|
8 |
be provided or otherwise made available to, or used by, any |
|
9 |
other person. No title to or ownership of the software is |
|
10 |
hereby transferred. |
|
11 |
" |
|
1410 | 12 |
"{ Package: 'stx:libview2' }" |
13 |
||
643 | 14 |
Object subclass:#MIMETypes |
1612 | 15 |
instanceVariableNames:'' |
1729 | 16 |
classVariableNames:'TypeToImageReaderClassMapping TypeToCommentStringMapping |
1979
0612875a95c1
acroread command from registry (win32)
Claus Gittinger <cg@exept.de>
parents:
1925
diff
changeset
|
17 |
TypeToFileSuffixMapping TypeToViewerApplicationMapping |
1729 | 18 |
SuffixToCommentStringMapping FileSuffixToTypeMapping |
1979
0612875a95c1
acroread command from registry (win32)
Claus Gittinger <cg@exept.de>
parents:
1925
diff
changeset
|
19 |
FilenameToTypeMapping FileSuffixToImageReaderClassMapping |
0612875a95c1
acroread command from registry (win32)
Claus Gittinger <cg@exept.de>
parents:
1925
diff
changeset
|
20 |
CharSetToFontMapping LastSuffix LastType |
2298 | 21 |
DefaultCommandPerMIMEPerOS DefaultPrintCommandPerMIMEPerOS |
3359 | 22 |
TypeToParenthesisSpecMapping SuffixToParenthesisSpecMapping |
23 |
TypeToInfoMapping' |
|
1612 | 24 |
poolDictionaries:'' |
1800 | 25 |
category:'Net-Communication-Support' |
1612 | 26 |
! |
27 |
||
3359 | 28 |
ImmutableString variableByteSubclass:#MIMEType |
1612 | 29 |
instanceVariableNames:'' |
30 |
classVariableNames:'CachedTypes' |
|
31 |
poolDictionaries:'' |
|
32 |
privateIn:MIMETypes |
|
643 | 33 |
! |
34 |
||
35 |
!MIMETypes class methodsFor:'documentation'! |
|
36 |
||
37 |
copyright |
|
38 |
" |
|
39 |
COPYRIGHT (c) 1997 by eXept Software AG |
|
1612 | 40 |
All Rights Reserved |
643 | 41 |
|
42 |
This software is furnished under a license and may be used |
|
43 |
only in accordance with the terms of that license and with the |
|
44 |
inclusion of the above copyright notice. This software may not |
|
45 |
be provided or otherwise made available to, or used by, any |
|
46 |
other person. No title to or ownership of the software is |
|
47 |
hereby transferred. |
|
48 |
||
49 |
||
50 |
" |
|
51 |
! |
|
52 |
||
53 |
documentation |
|
54 |
" |
|
55 |
just a place to keep MIME information |
|
56 |
(avoid spreading things at many places) |
|
57 |
||
1021 | 58 |
MIMETypes is abstract and functional. |
59 |
Actually, in some OperatingSystems, this information may |
|
60 |
be found in some config files (or registries). |
|
61 |
Therefore, this class may have to be extended to support this |
|
62 |
and fetch the information from there eventually. |
|
63 |
||
643 | 64 |
[author:] |
65 |
Claus Gittinger |
|
66 |
" |
|
1311 | 67 |
! |
68 |
||
2486
42063a7fc3db
mimeType: x-expecco-testSuite (extension: ets)
Claus Gittinger <cg@exept.de>
parents:
2479
diff
changeset
|
69 |
examples |
42063a7fc3db
mimeType: x-expecco-testSuite (extension: ets)
Claus Gittinger <cg@exept.de>
parents:
2479
diff
changeset
|
70 |
" |
2970
8b91ec204044
comment/format in: #initialize
Claus Gittinger <cg@exept.de>
parents:
2968
diff
changeset
|
71 |
[exBegin] |
3210 | 72 |
MIMETypes mimeTypeFromString:'text/plain' |
73 |
[exEnd] |
|
74 |
[exBegin] |
|
2487
eaa224da42fa
mimeType: x-expecco-testsuite (extension: ets)
Claus Gittinger <cg@exept.de>
parents:
2486
diff
changeset
|
75 |
MIMETypes mimeTypeFromString:'application/x-expecco-testsuite' |
2970
8b91ec204044
comment/format in: #initialize
Claus Gittinger <cg@exept.de>
parents:
2968
diff
changeset
|
76 |
[exEnd] |
2486
42063a7fc3db
mimeType: x-expecco-testSuite (extension: ets)
Claus Gittinger <cg@exept.de>
parents:
2479
diff
changeset
|
77 |
|
2970
8b91ec204044
comment/format in: #initialize
Claus Gittinger <cg@exept.de>
parents:
2968
diff
changeset
|
78 |
[exBegin] |
2486
42063a7fc3db
mimeType: x-expecco-testSuite (extension: ets)
Claus Gittinger <cg@exept.de>
parents:
2479
diff
changeset
|
79 |
MIMETypes mimeTypeForSuffix:'gif' |
2970
8b91ec204044
comment/format in: #initialize
Claus Gittinger <cg@exept.de>
parents:
2968
diff
changeset
|
80 |
MIMETypes mimeTypeForSuffix:'ets' |
8b91ec204044
comment/format in: #initialize
Claus Gittinger <cg@exept.de>
parents:
2968
diff
changeset
|
81 |
MIMETypes mimeTypeForSuffix:'xlsx' |
8b91ec204044
comment/format in: #initialize
Claus Gittinger <cg@exept.de>
parents:
2968
diff
changeset
|
82 |
[exEnd] |
2486
42063a7fc3db
mimeType: x-expecco-testSuite (extension: ets)
Claus Gittinger <cg@exept.de>
parents:
2479
diff
changeset
|
83 |
" |
42063a7fc3db
mimeType: x-expecco-testSuite (extension: ets)
Claus Gittinger <cg@exept.de>
parents:
2479
diff
changeset
|
84 |
! |
42063a7fc3db
mimeType: x-expecco-testSuite (extension: ets)
Claus Gittinger <cg@exept.de>
parents:
2479
diff
changeset
|
85 |
|
1311 | 86 |
knownTypes |
87 |
" |
|
88 |
simply a reminder for me ... |
|
89 |
||
90 |
application mime file extentsions |
|
91 |
||
92 |
powerpoint application/ms-powerpoint .pot, .ppz, .ppt, .pps, |
|
93 |
application/mspowerpoint |
|
94 |
application/vnd.ms-powerpoint |
|
95 |
application/x-mspowerpoint |
|
96 |
||
1312 | 97 |
shockwave application/x-shockwave-flash .swf |
1311 | 98 |
|
1312 | 99 |
futuresplash application/futuresplash .spl |
1311 | 100 |
" |
643 | 101 |
! ! |
102 |
||
103 |
!MIMETypes class methodsFor:'initialization'! |
|
104 |
||
1729 | 105 |
initialize |
106 |
"initialize wellKnown facts" |
|
2491
831417cc1e5b
Change bas spelling: parentesis to good spellinge parenthesis
Stefan Vogel <sv@exept.de>
parents:
2490
diff
changeset
|
107 |
|
831417cc1e5b
Change bas spelling: parentesis to good spellinge parenthesis
Stefan Vogel <sv@exept.de>
parents:
2490
diff
changeset
|
108 |
MIMEType initialize. "must be initialized first" |
1729 | 109 |
LastSuffix := LastType := nil. |
110 |
self initializeFileNameToMimeTypeMapping. |
|
111 |
self initializeImageReaderMappings. |
|
112 |
self initializeCommentStringMappings. |
|
2491
831417cc1e5b
Change bas spelling: parentesis to good spellinge parenthesis
Stefan Vogel <sv@exept.de>
parents:
2490
diff
changeset
|
113 |
self initializeParenthesisSpecMappings. |
1729 | 114 |
|
115 |
" |
|
2970
8b91ec204044
comment/format in: #initialize
Claus Gittinger <cg@exept.de>
parents:
2968
diff
changeset
|
116 |
self initialize |
8b91ec204044
comment/format in: #initialize
Claus Gittinger <cg@exept.de>
parents:
2968
diff
changeset
|
117 |
" |
8b91ec204044
comment/format in: #initialize
Claus Gittinger <cg@exept.de>
parents:
2968
diff
changeset
|
118 |
|
2298 | 119 |
"Modified: / 10-04-2007 / 15:16:44 / cg" |
2970
8b91ec204044
comment/format in: #initialize
Claus Gittinger <cg@exept.de>
parents:
2968
diff
changeset
|
120 |
"Modified (comment): / 29-11-2011 / 19:11:51 / cg" |
1729 | 121 |
! |
122 |
||
123 |
initializeCommentStringMappings |
|
3359 | 124 |
"these are used by the editor's comment/uncomment functions" |
125 |
||
1729 | 126 |
TypeToCommentStringMapping := Dictionary new. |
127 |
SuffixToCommentStringMapping := Dictionary new. |
|
128 |
||
129 |
TypeToCommentStringMapping |
|
130 |
at:'application/x-make' |
|
3359 | 131 |
put:#('#' (nil nil)). "/ '#' EOL comments only |
1729 | 132 |
|
133 |
TypeToCommentStringMapping |
|
134 |
at:'application/x-sh' |
|
3359 | 135 |
put:#('#' (nil nil)). "/ '#' EOL comments only |
1729 | 136 |
|
2489
b891d96fd496
elf extension: x-expecco-logfile
Claus Gittinger <cg@exept.de>
parents:
2487
diff
changeset
|
137 |
#('text/html' 'text/xml' |
b891d96fd496
elf extension: x-expecco-logfile
Claus Gittinger <cg@exept.de>
parents:
2487
diff
changeset
|
138 |
'application/xml' |
b891d96fd496
elf extension: x-expecco-logfile
Claus Gittinger <cg@exept.de>
parents:
2487
diff
changeset
|
139 |
'application/x-expecco-testsuite' |
b891d96fd496
elf extension: x-expecco-logfile
Claus Gittinger <cg@exept.de>
parents:
2487
diff
changeset
|
140 |
'application/x-expecco-logfile' |
b891d96fd496
elf extension: x-expecco-logfile
Claus Gittinger <cg@exept.de>
parents:
2487
diff
changeset
|
141 |
) |
1729 | 142 |
do:[:eachXMLType | |
143 |
TypeToCommentStringMapping |
|
144 |
at:eachXMLType |
|
145 |
put:#(nil ('<!!-- ' ' -->')). "/ '<!!-- ... -->' delimited comments only |
|
146 |
]. |
|
147 |
||
148 |
TypeToCommentStringMapping |
|
2055 | 149 |
at:'text/css' |
150 |
put:#('//' ('/*' '*/')). |
|
151 |
||
152 |
TypeToCommentStringMapping |
|
1729 | 153 |
at:'application/x-batch-script' |
2937
67ef44218dc0
changed: #initializeCommentStringMappings
Claus Gittinger <cg@exept.de>
parents:
2924
diff
changeset
|
154 |
put:#('@REM ' '@rem ' 'REM ' 'rem ' (nil nil)). "/ 'rem ' for EOL comments only |
1729 | 155 |
|
156 |
"/ the following is ST/X specific |
|
157 |
TypeToCommentStringMapping |
|
158 |
at:'application/x-smalltalk-source' |
|
159 |
put:#('"/' ('"' '"')). "/ '"/ ' for EOL; ".." for delimited comments |
|
160 |
||
161 |
"/ this is for standard smalltalk |
|
162 |
"/ TypeToCommentStringMapping |
|
163 |
"/ at:'application/x-smalltalk-source' |
|
164 |
"/ put:#(nil ('"' '"')). "/ ".." for delimited comments only |
|
165 |
||
166 |
||
167 |
TypeToCommentStringMapping |
|
168 |
at:'application/x-pascal-source' |
|
169 |
put:#(nil ('{' '}')). "/ '{'..'}' for delimited comments |
|
170 |
||
171 |
"/ this is ANSI-c |
|
172 |
TypeToCommentStringMapping |
|
173 |
at:'application/x-c-source' |
|
174 |
put:#('//' ('/*' '*/')). |
|
175 |
||
176 |
TypeToCommentStringMapping |
|
177 |
at:'application/x-cpp-source' |
|
178 |
put:#('//' ('/*' '*/')). |
|
179 |
||
180 |
TypeToCommentStringMapping |
|
2479 | 181 |
at:'application/x-csharp-source' |
182 |
put:#('//' ('/*' '*/')). |
|
183 |
||
184 |
TypeToCommentStringMapping |
|
1729 | 185 |
at:'application/x-java-source' |
186 |
put:#('//' ('/*' '*/')). |
|
187 |
||
188 |
TypeToCommentStringMapping |
|
2048
dbb361dd9c5f
comment strings for javascript files
Claus Gittinger <cg@exept.de>
parents:
2028
diff
changeset
|
189 |
at:'application/x-javascript' |
dbb361dd9c5f
comment strings for javascript files
Claus Gittinger <cg@exept.de>
parents:
2028
diff
changeset
|
190 |
put:#('//' ('/*' '*/')). |
dbb361dd9c5f
comment strings for javascript files
Claus Gittinger <cg@exept.de>
parents:
2028
diff
changeset
|
191 |
|
dbb361dd9c5f
comment strings for javascript files
Claus Gittinger <cg@exept.de>
parents:
2028
diff
changeset
|
192 |
TypeToCommentStringMapping |
2298 | 193 |
at:'application/x-lisp-source' |
194 |
put:#(';' (nil nil)). "/ '#' for EOL comments only |
|
195 |
||
196 |
TypeToCommentStringMapping |
|
1729 | 197 |
at:'application/x-asn1-source' |
198 |
put:#('--' ('--' '--')). |
|
199 |
||
200 |
||
201 |
"/ st/x support files |
|
202 |
SuffixToCommentStringMapping |
|
203 |
at:'style' |
|
204 |
put:#(';' (nil nil)). |
|
1604 | 205 |
|
1729 | 206 |
SuffixToCommentStringMapping |
207 |
at:'rs' |
|
2298 | 208 |
put:#(';' (nil nil)). |
209 |
||
2937
67ef44218dc0
changed: #initializeCommentStringMappings
Claus Gittinger <cg@exept.de>
parents:
2924
diff
changeset
|
210 |
"Modified: / 06-09-2011 / 10:46:27 / cg" |
1729 | 211 |
! |
212 |
||
213 |
initializeDefaultCommands |
|
3359 | 214 |
"these are used to select an application to be opened when a file of a particular |
215 |
type is double clicked in the browser. |
|
216 |
TODO: move this to OS" |
|
1729 | 217 |
|
3253 | 218 |
|unixCommands win32Commands unixPrintCommands win32PrintCommands listToTry| |
1729 | 219 |
|
220 |
DefaultCommandPerMIMEPerOS := Dictionary new. |
|
221 |
DefaultCommandPerMIMEPerOS at:#unix put:(unixCommands := Dictionary new). |
|
222 |
DefaultCommandPerMIMEPerOS at:#win32 put:(win32Commands := Dictionary new). |
|
223 |
||
3187 | 224 |
unixCommands at:'application/x-tar-compressed' put:'tar tvf -'. |
1729 | 225 |
|
2141 | 226 |
OperatingSystem isMSWINDOWSlike ifFalse:[ |cmd| |
3253 | 227 |
OperatingSystem isOSXlike ifTrue:[ |
3322 | 228 |
unixCommands at:'text/html' put:('open -a Safari "%1"'). |
229 |
unixCommands at:'application/pdf' put:('open -a Preview "%1"'). |
|
3253 | 230 |
] ifFalse:[ |
3322 | 231 |
listToTry := #('firefox' 'chrome' 'chromium' 'konqueror' 'opera'). |
232 |
cmd := listToTry |
|
233 |
detect:[:aCmd| (OperatingSystem pathOfCommand:aCmd) notEmptyOrNil ] |
|
234 |
ifNone:nil. |
|
235 |
cmd notNil ifTrue:[ |
|
236 |
unixCommands at:'text/html' put:(cmd, ' "%1"') |
|
237 |
]. |
|
3187 | 238 |
|
3322 | 239 |
listToTry := #('acroread' 'okular' 'evince' 'kpdf' 'xpdf'). |
240 |
cmd := listToTry |
|
241 |
detect:[:aCmd| (OperatingSystem pathOfCommand:aCmd) notEmptyOrNil ] |
|
242 |
ifNone:nil. |
|
243 |
cmd notNil ifTrue:[ |
|
244 |
unixCommands at:'application/pdf' put:(cmd, ' "%1"') |
|
245 |
]. |
|
3187 | 246 |
]. |
2141 | 247 |
]. |
248 |
||
249 |
||
2116 | 250 |
DefaultPrintCommandPerMIMEPerOS := Dictionary new. |
251 |
DefaultPrintCommandPerMIMEPerOS at:#unix put:(unixPrintCommands := Dictionary new). |
|
252 |
DefaultPrintCommandPerMIMEPerOS at:#win32 put:(win32PrintCommands := Dictionary new). |
|
253 |
||
254 |
"/ if you have a good (intelligent) spooler ;-) |
|
2904
bb555534881e
changed: #initializeDefaultCommands
Stefan Vogel <sv@exept.de>
parents:
2892
diff
changeset
|
255 |
unixPrintCommands at:'application/pdf' put:'lpr "%1"'. |
2116 | 256 |
"/ if not, you may need more... |
257 |
"/ unixPrintCommands at:'application/pdf' put:'pdfToPS %1 | lpr'. |
|
258 |
||
1729 | 259 |
" |
260 |
self initializeDefaultCommands |
|
261 |
" |
|
1979
0612875a95c1
acroread command from registry (win32)
Claus Gittinger <cg@exept.de>
parents:
1925
diff
changeset
|
262 |
|
0612875a95c1
acroread command from registry (win32)
Claus Gittinger <cg@exept.de>
parents:
1925
diff
changeset
|
263 |
"Modified: / 12-05-2004 / 11:43:23 / cg" |
1729 | 264 |
! |
265 |
||
3359 | 266 |
initializeFileInfoMappings |
267 |
"these are used by the file browser if a 'file' command is not present in the OS" |
|
268 |
||
269 |
TypeToInfoMapping := Dictionary new. |
|
270 |
||
271 |
TypeToInfoMapping at:'application/x-smalltalk-source' put:'Smalltalk source'. |
|
272 |
TypeToInfoMapping at:'text/html' put:'HTML document'. |
|
273 |
TypeToInfoMapping at:'text/xml' put:'XML document'. |
|
274 |
TypeToInfoMapping at:'application/xml' put:'XML document'. |
|
275 |
TypeToInfoMapping at:'application/x-c-source' put:'C source'. |
|
276 |
TypeToInfoMapping at:'application/x-c-header' put:'C header file'. |
|
277 |
TypeToInfoMapping at:'application/x-cpp-source' put:'C++ source'. |
|
278 |
TypeToInfoMapping at:'application/x-csharp-source' put:'C# source'. |
|
279 |
TypeToInfoMapping at:'application/x-java-source' put:'Java source'. |
|
280 |
TypeToInfoMapping at:'application/x-javascript' put:'Javascript source'. |
|
281 |
TypeToInfoMapping at:'application/x-lisp-source' put:'Lisp source'. |
|
282 |
||
283 |
TypeToInfoMapping at:'application/x-make' put:'make rules'. |
|
284 |
TypeToInfoMapping at:'application/binary' put:'binary object file'. |
|
285 |
||
286 |
" |
|
287 |
self initializeFileInfoMappings |
|
288 |
'foo.H' asFilename mimeTypeFromName |
|
289 |
'foo.o' asFilename mimeTypeFromName |
|
290 |
" |
|
291 |
! |
|
292 |
||
1729 | 293 |
initializeFileNameToMimeTypeMapping |
294 |
"initialize wellKnown facts" |
|
295 |
||
296 |
|types| |
|
297 |
||
298 |
FileSuffixToTypeMapping isNil ifTrue:[ |
|
299 |
FileSuffixToTypeMapping := Dictionary new |
|
300 |
]. |
|
1887 | 301 |
TypeToFileSuffixMapping isNil ifTrue:[ |
302 |
TypeToFileSuffixMapping := Dictionary new |
|
303 |
]. |
|
1729 | 304 |
FilenameToTypeMapping isNil ifTrue:[ |
305 |
FilenameToTypeMapping := Dictionary new. |
|
306 |
]. |
|
307 |
||
308 |
types := OrderedCollection new. |
|
309 |
types addAll:self textTypeList. |
|
310 |
types addAll:self imageTypeList. |
|
311 |
types addAll:self videoTypeList. |
|
312 |
types addAll:self audioTypeList. |
|
313 |
types addAll:self applicationTypeList. |
|
1888
ef0f346b8f43
rpm suffix is RPM-package under unix (realplayer under windows)
Claus Gittinger <cg@exept.de>
parents:
1887
diff
changeset
|
314 |
types addAll:self osSpecificTypeList. |
ef0f346b8f43
rpm suffix is RPM-package under unix (realplayer under windows)
Claus Gittinger <cg@exept.de>
parents:
1887
diff
changeset
|
315 |
|
1729 | 316 |
types pairWiseDo:[:suff :typeString| |
317 |
|type| |
|
318 |
||
319 |
type := MIMEType fromString:typeString. |
|
320 |
suff isArray ifTrue:[ |
|
1887 | 321 |
suff do:[:s | FileSuffixToTypeMapping at:s put:type]. |
322 |
TypeToFileSuffixMapping at:type put:suff first. |
|
1729 | 323 |
] ifFalse:[ |
1887 | 324 |
FileSuffixToTypeMapping at:suff put:type. |
325 |
TypeToFileSuffixMapping at:type put:suff. |
|
326 |
]. |
|
1729 | 327 |
]. |
328 |
||
329 |
self miscFilenameList pairWiseDo:[:nm :typeString| |
|
330 |
|type| |
|
331 |
||
332 |
type := MIMEType fromString:typeString. |
|
333 |
nm isArray ifTrue:[ |
|
334 |
nm do:[:s | FilenameToTypeMapping at:s put:type] |
|
335 |
] ifFalse:[ |
|
336 |
FilenameToTypeMapping at:nm put:type |
|
337 |
] |
|
338 |
]. |
|
1888
ef0f346b8f43
rpm suffix is RPM-package under unix (realplayer under windows)
Claus Gittinger <cg@exept.de>
parents:
1887
diff
changeset
|
339 |
|
ef0f346b8f43
rpm suffix is RPM-package under unix (realplayer under windows)
Claus Gittinger <cg@exept.de>
parents:
1887
diff
changeset
|
340 |
" |
ef0f346b8f43
rpm suffix is RPM-package under unix (realplayer under windows)
Claus Gittinger <cg@exept.de>
parents:
1887
diff
changeset
|
341 |
self initializeFileNameToMimeTypeMapping |
ef0f346b8f43
rpm suffix is RPM-package under unix (realplayer under windows)
Claus Gittinger <cg@exept.de>
parents:
1887
diff
changeset
|
342 |
" |
1729 | 343 |
! |
344 |
||
345 |
initializeImageReaderMappings |
|
3359 | 346 |
"these are used so select an image reader, based on a bitmap image's mime type" |
347 |
||
3295 | 348 |
|rdr| |
349 |
||
1729 | 350 |
FileSuffixToImageReaderClassMapping isNil ifTrue:[ |
351 |
FileSuffixToImageReaderClassMapping := Dictionary new |
|
352 |
]. |
|
353 |
"MIME" TypeToImageReaderClassMapping isNil ifTrue:[ |
|
354 |
TypeToImageReaderClassMapping := Dictionary new |
|
355 |
]. |
|
356 |
||
357 |
"/ setup mimeType to image reader class mapping ... |
|
358 |
TypeToImageReaderClassMapping at:'image/jpeg' put:JPEGReader. |
|
359 |
TypeToImageReaderClassMapping at:'image/gif' put:GIFReader. |
|
360 |
TypeToImageReaderClassMapping at:'image/tiff' put:TIFFReader. |
|
2710 | 361 |
TypeToImageReaderClassMapping at:'image/png' put:PNGReader. |
3380 | 362 |
TypeToImageReaderClassMapping at:'image/icns' put:MacOSXIconReader. |
1729 | 363 |
|
364 |
"/ setup suffix to image reader class mapping ... |
|
365 |
FileSuffixToImageReaderClassMapping at:'jpg' put:JPEGReader. |
|
3295 | 366 |
FileSuffixToImageReaderClassMapping at:'jpeg' put:JPEGReader. |
1729 | 367 |
FileSuffixToImageReaderClassMapping at:'gif' put:GIFReader. |
368 |
FileSuffixToImageReaderClassMapping at:'tif' put:TIFFReader. |
|
3295 | 369 |
FileSuffixToImageReaderClassMapping at:'tiff' put:TIFFReader. |
2710 | 370 |
FileSuffixToImageReaderClassMapping at:'png' put:PNGReader. |
3380 | 371 |
FileSuffixToImageReaderClassMapping at:'icns' put:MacOSXIconReader. |
2570 | 372 |
|
3295 | 373 |
"/ some 'used-to-be-optional' readers |
374 |
(rdr := Smalltalk at:#WindowsIconReader) notNil ifTrue:[ |
|
375 |
TypeToImageReaderClassMapping at:'image/bmp' put:rdr. |
|
376 |
TypeToImageReaderClassMapping at:'image/x-MS-bmp' put:rdr. |
|
377 |
TypeToImageReaderClassMapping at:'image/x-MS-ico' put:rdr. |
|
378 |
FileSuffixToImageReaderClassMapping at:'bmp' put:rdr. |
|
379 |
FileSuffixToImageReaderClassMapping at:'ico' put:rdr. |
|
380 |
]. |
|
381 |
(rdr := Smalltalk at:#XBMReader) notNil ifTrue:[ |
|
382 |
TypeToImageReaderClassMapping at:'image/x-xbitmap' put:rdr. |
|
383 |
FileSuffixToImageReaderClassMapping at:'xbm' put:rdr. |
|
384 |
]. |
|
385 |
(rdr := Smalltalk at:#XPMReader) notNil ifTrue:[ |
|
386 |
TypeToImageReaderClassMapping at:'image/x-xpixmap' put:rdr. |
|
387 |
FileSuffixToImageReaderClassMapping at:'pm' put:rdr. |
|
388 |
]. |
|
389 |
(rdr := Smalltalk at:#PBMReader) notNil ifTrue:[ |
|
390 |
TypeToImageReaderClassMapping at:'image/x-portable-pixmap' put:rdr. |
|
391 |
TypeToImageReaderClassMapping at:'image/x-portable-bitmap' put:rdr. |
|
392 |
TypeToImageReaderClassMapping at:'image/x-portable-graymap' put:rdr. |
|
393 |
TypeToImageReaderClassMapping at:'image/x-portable-anymap' put:rdr. |
|
394 |
FileSuffixToImageReaderClassMapping at:'ppm' put:rdr. |
|
395 |
FileSuffixToImageReaderClassMapping at:'pbm' put:rdr. |
|
396 |
FileSuffixToImageReaderClassMapping at:'pgm' put:rdr. |
|
397 |
FileSuffixToImageReaderClassMapping at:'pnm' put:rdr. |
|
398 |
]. |
|
399 |
(rdr := Smalltalk at:#PCXReader) notNil ifTrue:[ |
|
400 |
TypeToImageReaderClassMapping at:'image/x-pcx' put:rdr. |
|
401 |
FileSuffixToImageReaderClassMapping at:'pcx' put:rdr. |
|
402 |
]. |
|
403 |
(rdr := Smalltalk at:#TargaReader) notNil ifTrue:[ |
|
404 |
TypeToImageReaderClassMapping at:'image/x-targa' put:rdr. |
|
405 |
FileSuffixToImageReaderClassMapping at:'tga' put:rdr. |
|
406 |
]. |
|
407 |
(rdr := Smalltalk at:#XWDReader) notNil ifTrue:[ |
|
408 |
TypeToImageReaderClassMapping at:'image/x-xwindowdump' put:rdr. |
|
409 |
TypeToImageReaderClassMapping at:'image/x-windowdump' put:rdr. |
|
410 |
FileSuffixToImageReaderClassMapping at:'xwd' put:rdr. |
|
411 |
]. |
|
412 |
(rdr := Smalltalk at:#BlitImageReader) notNil ifTrue:[ |
|
413 |
TypeToImageReaderClassMapping at:'image/x-blitimage' put:rdr. |
|
414 |
FileSuffixToImageReaderClassMapping at:'48x48x1' put:rdr. |
|
415 |
]. |
|
416 |
(rdr := Smalltalk at:#IrisRGBReader) notNil ifTrue:[ |
|
417 |
TypeToImageReaderClassMapping at:'image/x-rgb' put:rdr. |
|
418 |
FileSuffixToImageReaderClassMapping at:'rgb' put:rdr. |
|
419 |
]. |
|
420 |
(rdr := Smalltalk at:#SunRasterReader) notNil ifTrue:[ |
|
421 |
TypeToImageReaderClassMapping at:'image/x-sunraster' put:rdr. |
|
422 |
FileSuffixToImageReaderClassMapping at:'im8' put:rdr. |
|
423 |
FileSuffixToImageReaderClassMapping at:'icon' put:rdr. |
|
2570 | 424 |
]. |
3295 | 425 |
(rdr := Smalltalk at:#ST80FormReader) notNil ifTrue:[ |
426 |
TypeToImageReaderClassMapping at:'image/x-st80-form' put:rdr. |
|
427 |
FileSuffixToImageReaderClassMapping at:'form' put:rdr. |
|
428 |
]. |
|
429 |
(rdr := Smalltalk at:#FaceReader) notNil ifTrue:[ |
|
430 |
TypeToImageReaderClassMapping at:'image/x-face' put:rdr. |
|
431 |
FileSuffixToImageReaderClassMapping at:'face' put:rdr. |
|
432 |
]. |
|
433 |
(rdr := Smalltalk at:#PCDReader) notNil ifTrue:[ |
|
434 |
TypeToImageReaderClassMapping at:'image/x-photo-cd' put:rdr. |
|
435 |
FileSuffixToImageReaderClassMapping at:'pcd' put:rdr. |
|
436 |
]. |
|
437 |
(rdr := Smalltalk at:#CMURasterReader) notNil ifTrue:[ |
|
438 |
TypeToImageReaderClassMapping at:'image/x-cmu-raster' put:rdr. |
|
439 |
FileSuffixToImageReaderClassMapping at:'ras' put:rdr. |
|
440 |
]. |
|
441 |
||
3359 | 442 |
"/ movie formats - experimental and not yet complete / finished / delivered / published |
3295 | 443 |
"/ (rdr := Smalltalk at:#FLIReader) notNil ifTrue:[ |
444 |
"/ TypeToImageReaderClassMapping at:'video/x-fli' put:rdr. |
|
445 |
"/ FileSuffixToImageReaderClassMapping at:'fli' put:rdr. |
|
446 |
"/ ]. |
|
447 |
"/ (rdr := Smalltalk at:#AVIReader) notNil ifTrue:[ |
|
448 |
"/ TypeToImageReaderClassMapping at:'video/x-msvideo' put:rdr. |
|
449 |
"/ FileSuffixToImageReaderClassMapping at:'avi' put:rdr. |
|
450 |
"/ ]. |
|
451 |
"/ (rdr := Smalltalk at:#AVIReader) notNil ifTrue:[ |
|
452 |
"/ TypeToImageReaderClassMapping at:'video/x-msvideo' put:rdr. |
|
453 |
"/ FileSuffixToImageReaderClassMapping at:'avi' put:rdr. |
|
454 |
"/ ]. |
|
455 |
"/ (rdr := Smalltalk at:#QuickTimeReader) notNil ifTrue:[ |
|
456 |
"/ TypeToImageReaderClassMapping at:'video/quicktime' put:rdr. |
|
457 |
"/ FileSuffixToImageReaderClassMapping at:'qt' put:rdr. |
|
458 |
"/ FileSuffixToImageReaderClassMapping at:'mov' put:rdr. |
|
459 |
"/ FileSuffixToImageReaderClassMapping at:'moov' put:rdr. |
|
460 |
"/ ]. |
|
461 |
"/ (rdr := Smalltalk at:#MPEG2Reader) notNil ifTrue:[ |
|
462 |
"/ TypeToImageReaderClassMapping at:'video/x-mpeg2' put:rdr. |
|
463 |
"/ FileSuffixToImageReaderClassMapping at:'mpg2' put:rdr. |
|
464 |
"/ FileSuffixToImageReaderClassMapping at:'mpv2' put:rdr. |
|
465 |
"/ FileSuffixToImageReaderClassMapping at:'mp2v' put:rdr. |
|
466 |
"/ FileSuffixToImageReaderClassMapping at:'mp2' put:rdr. |
|
467 |
"/ ]. |
|
468 |
"/ (rdr := Smalltalk at:#MPEGReader) notNil ifTrue:[ |
|
469 |
"/ TypeToImageReaderClassMapping at:'video/mpeg' put:rdr. |
|
470 |
"/ FileSuffixToImageReaderClassMapping at:'mpg' put:rdr. |
|
471 |
"/ FileSuffixToImageReaderClassMapping at:'mpeg' put:rdr. |
|
472 |
"/ FileSuffixToImageReaderClassMapping at:'mpe' put:rdr. |
|
473 |
"/ FileSuffixToImageReaderClassMapping at:'mpv' put:rdr. |
|
474 |
"/ FileSuffixToImageReaderClassMapping at:'vps' put:rdr. |
|
475 |
"/ FileSuffixToImageReaderClassMapping at:'mpegv' put:rdr. |
|
476 |
"/ ]. |
|
477 |
"/ (rdr := Smalltalk at:#SGIMovieReader) notNil ifTrue:[ |
|
478 |
"/ TypeToImageReaderClassMapping at:'video/x-sgi-movie' put:rdr. |
|
479 |
"/ FileSuffixToImageReaderClassMapping at:'movie' put:rdr. |
|
480 |
"/ ]. |
|
2298 | 481 |
! |
482 |
||
2491
831417cc1e5b
Change bas spelling: parentesis to good spellinge parenthesis
Stefan Vogel <sv@exept.de>
parents:
2490
diff
changeset
|
483 |
initializeParenthesisSpecMappings |
3359 | 484 |
"these are used by the editors to mark matching parenthesis" |
485 |
||
2298 | 486 |
|spec| |
487 |
||
2491
831417cc1e5b
Change bas spelling: parentesis to good spellinge parenthesis
Stefan Vogel <sv@exept.de>
parents:
2490
diff
changeset
|
488 |
TypeToParenthesisSpecMapping := Dictionary new. |
831417cc1e5b
Change bas spelling: parentesis to good spellinge parenthesis
Stefan Vogel <sv@exept.de>
parents:
2490
diff
changeset
|
489 |
SuffixToParenthesisSpecMapping := Dictionary new. |
831417cc1e5b
Change bas spelling: parentesis to good spellinge parenthesis
Stefan Vogel <sv@exept.de>
parents:
2490
diff
changeset
|
490 |
|
2298 | 491 |
"/ ST/X spec |
2491
831417cc1e5b
Change bas spelling: parentesis to good spellinge parenthesis
Stefan Vogel <sv@exept.de>
parents:
2490
diff
changeset
|
492 |
spec := IdentityDictionary new. |
831417cc1e5b
Change bas spelling: parentesis to good spellinge parenthesis
Stefan Vogel <sv@exept.de>
parents:
2490
diff
changeset
|
493 |
spec at:#open put:#( $( $[ ${ ). |
831417cc1e5b
Change bas spelling: parentesis to good spellinge parenthesis
Stefan Vogel <sv@exept.de>
parents:
2490
diff
changeset
|
494 |
spec at:#close put:#( $) $] $} ). |
831417cc1e5b
Change bas spelling: parentesis to good spellinge parenthesis
Stefan Vogel <sv@exept.de>
parents:
2490
diff
changeset
|
495 |
spec at:#ignore put:#( $' $" '$[' '$]' '${' '$)' ). |
831417cc1e5b
Change bas spelling: parentesis to good spellinge parenthesis
Stefan Vogel <sv@exept.de>
parents:
2490
diff
changeset
|
496 |
spec at:#eolComment put:'"/'. |
831417cc1e5b
Change bas spelling: parentesis to good spellinge parenthesis
Stefan Vogel <sv@exept.de>
parents:
2490
diff
changeset
|
497 |
TypeToParenthesisSpecMapping at:'application/x-smalltalk-source' put:spec. |
831417cc1e5b
Change bas spelling: parentesis to good spellinge parenthesis
Stefan Vogel <sv@exept.de>
parents:
2490
diff
changeset
|
498 |
|
2479 | 499 |
"/ XML & HTML |
2491
831417cc1e5b
Change bas spelling: parentesis to good spellinge parenthesis
Stefan Vogel <sv@exept.de>
parents:
2490
diff
changeset
|
500 |
spec := IdentityDictionary new. |
831417cc1e5b
Change bas spelling: parentesis to good spellinge parenthesis
Stefan Vogel <sv@exept.de>
parents:
2490
diff
changeset
|
501 |
spec at:#open put:#( $< ). |
831417cc1e5b
Change bas spelling: parentesis to good spellinge parenthesis
Stefan Vogel <sv@exept.de>
parents:
2490
diff
changeset
|
502 |
spec at:#close put:#( $> ). |
831417cc1e5b
Change bas spelling: parentesis to good spellinge parenthesis
Stefan Vogel <sv@exept.de>
parents:
2490
diff
changeset
|
503 |
spec at:#ignore put:#( $' $" '$[' '$]' '${' '$)' ). |
831417cc1e5b
Change bas spelling: parentesis to good spellinge parenthesis
Stefan Vogel <sv@exept.de>
parents:
2490
diff
changeset
|
504 |
#( 'text/html' 'text/xml' 'application/xml' ) do:[:eachXMLType | |
831417cc1e5b
Change bas spelling: parentesis to good spellinge parenthesis
Stefan Vogel <sv@exept.de>
parents:
2490
diff
changeset
|
505 |
TypeToParenthesisSpecMapping at:eachXMLType put:spec |
2298 | 506 |
]. |
2491
831417cc1e5b
Change bas spelling: parentesis to good spellinge parenthesis
Stefan Vogel <sv@exept.de>
parents:
2490
diff
changeset
|
507 |
|
3359 | 508 |
"/ ANSI-c, Java, C# |
2491
831417cc1e5b
Change bas spelling: parentesis to good spellinge parenthesis
Stefan Vogel <sv@exept.de>
parents:
2490
diff
changeset
|
509 |
spec := IdentityDictionary new. |
831417cc1e5b
Change bas spelling: parentesis to good spellinge parenthesis
Stefan Vogel <sv@exept.de>
parents:
2490
diff
changeset
|
510 |
spec at:#open put:#( $( $[ ${ ). |
831417cc1e5b
Change bas spelling: parentesis to good spellinge parenthesis
Stefan Vogel <sv@exept.de>
parents:
2490
diff
changeset
|
511 |
spec at:#close put:#( $) $] $} ). |
831417cc1e5b
Change bas spelling: parentesis to good spellinge parenthesis
Stefan Vogel <sv@exept.de>
parents:
2490
diff
changeset
|
512 |
spec at:#ignore put:#( $' $" ). |
831417cc1e5b
Change bas spelling: parentesis to good spellinge parenthesis
Stefan Vogel <sv@exept.de>
parents:
2490
diff
changeset
|
513 |
spec at:#eolComment put:'//'. |
831417cc1e5b
Change bas spelling: parentesis to good spellinge parenthesis
Stefan Vogel <sv@exept.de>
parents:
2490
diff
changeset
|
514 |
TypeToParenthesisSpecMapping at:'application/x-c-source' put:spec. |
831417cc1e5b
Change bas spelling: parentesis to good spellinge parenthesis
Stefan Vogel <sv@exept.de>
parents:
2490
diff
changeset
|
515 |
TypeToParenthesisSpecMapping at:'application/x-cpp-source' put:spec. |
831417cc1e5b
Change bas spelling: parentesis to good spellinge parenthesis
Stefan Vogel <sv@exept.de>
parents:
2490
diff
changeset
|
516 |
TypeToParenthesisSpecMapping at:'application/x-csharp-source' put:spec. |
831417cc1e5b
Change bas spelling: parentesis to good spellinge parenthesis
Stefan Vogel <sv@exept.de>
parents:
2490
diff
changeset
|
517 |
TypeToParenthesisSpecMapping at:'application/x-java-source' put:spec. |
831417cc1e5b
Change bas spelling: parentesis to good spellinge parenthesis
Stefan Vogel <sv@exept.de>
parents:
2490
diff
changeset
|
518 |
TypeToParenthesisSpecMapping at:'application/x-javascript' put:spec. |
831417cc1e5b
Change bas spelling: parentesis to good spellinge parenthesis
Stefan Vogel <sv@exept.de>
parents:
2490
diff
changeset
|
519 |
|
3359 | 520 |
"/ Lisp / Scheme |
2491
831417cc1e5b
Change bas spelling: parentesis to good spellinge parenthesis
Stefan Vogel <sv@exept.de>
parents:
2490
diff
changeset
|
521 |
spec := IdentityDictionary new. |
3039 | 522 |
spec at:#open put:#( $( $[ ). |
523 |
spec at:#close put:#( $) $] ). |
|
2491
831417cc1e5b
Change bas spelling: parentesis to good spellinge parenthesis
Stefan Vogel <sv@exept.de>
parents:
2490
diff
changeset
|
524 |
spec at:#ignore put:#( $" ). |
831417cc1e5b
Change bas spelling: parentesis to good spellinge parenthesis
Stefan Vogel <sv@exept.de>
parents:
2490
diff
changeset
|
525 |
spec at:#eolComment put:';'. |
831417cc1e5b
Change bas spelling: parentesis to good spellinge parenthesis
Stefan Vogel <sv@exept.de>
parents:
2490
diff
changeset
|
526 |
TypeToParenthesisSpecMapping at:'application/x-lisp-source' put:spec. |
2298 | 527 |
|
528 |
"Created: / 10-04-2007 / 15:16:37 / cg" |
|
1729 | 529 |
! ! |
530 |
||
531 |
!MIMETypes class methodsFor:'initialization-lists'! |
|
532 |
||
533 |
applicationCompressorsAndArchiveTypeList |
|
1604 | 534 |
^ #( |
1890 | 535 |
'tar' 'application/x-tar' |
536 |
'gtar' 'application/x-gtar' |
|
1891 | 537 |
('tgz' 'tar.gz') 'application/x-tar-gzip-compressed' "/ 'application/x-tar-compressed' |
538 |
('tar.bz2') 'application/x-tar-bzip2-compressed' |
|
1890 | 539 |
'zip' 'application/x-zip-compressed' |
540 |
'bz2' 'application/x-bzip2-compressed' |
|
541 |
('gz' 'z') 'application/x-gzip-compressed' |
|
542 |
'cpio' 'application/x-cpio' |
|
543 |
'shar' 'application/x-shar' |
|
544 |
'jar' 'application/java-archive' |
|
545 |
'sar' 'application/x-squeak-archive' |
|
546 |
'sit' 'application/x-stuffit' |
|
547 |
'hqx' 'application/mac-binhex40' |
|
548 |
'cpt' 'application/mac-compactpro' |
|
1604 | 549 |
) |
550 |
! |
|
645 | 551 |
|
1609 | 552 |
applicationMiscTypeList |
553 |
"misc applications" |
|
554 |
||
555 |
^ #( |
|
556 |
('a' 'o' 'obj' ) 'application/binary' |
|
2968 | 557 |
('lic') 'application/license' |
1609 | 558 |
('dll' 'so') 'application/shared-library' |
2486
42063a7fc3db
mimeType: x-expecco-testSuite (extension: ets)
Claus Gittinger <cg@exept.de>
parents:
2479
diff
changeset
|
559 |
|
42063a7fc3db
mimeType: x-expecco-testSuite (extension: ets)
Claus Gittinger <cg@exept.de>
parents:
2479
diff
changeset
|
560 |
('ets') 'application/x-expecco-testsuite' |
3104 | 561 |
('etr') 'application/x-expecco-testrepository' |
2489
b891d96fd496
elf extension: x-expecco-logfile
Claus Gittinger <cg@exept.de>
parents:
2487
diff
changeset
|
562 |
('elf') 'application/x-expecco-logfile' |
2886
22b48a4da285
comment/format in: #initializeFileNameToMimeTypeMapping
sr
parents:
2830
diff
changeset
|
563 |
('expeccolicense') 'application/x-expecco-license' |
2888 | 564 |
('expeccopatch') 'application/x-expecco-patch' |
1609 | 565 |
) |
2886
22b48a4da285
comment/format in: #initializeFileNameToMimeTypeMapping
sr
parents:
2830
diff
changeset
|
566 |
|
2968 | 567 |
"Modified: / 03-11-2011 / 10:42:28 / sr" |
1609 | 568 |
! |
569 |
||
1604 | 570 |
applicationProgLangTypeList |
3020
3f9c74ff0975
changed: #applicationProgLangTypeList
Claus Gittinger <cg@exept.de>
parents:
3014
diff
changeset
|
571 |
"applications for programming languages" |
713 | 572 |
|
1604 | 573 |
^ #( |
1609 | 574 |
('st' 'cls' 'rc') 'application/x-smalltalk-source' |
1604 | 575 |
'sif' 'application/x-smalltalk-source-sif' |
1668 | 576 |
'pac' 'application/x-smalltalk-dolphin-package' |
1778 | 577 |
|
578 |
'sts' 'application/x-squeak-source' |
|
579 |
'pr' 'application/x-squeak-project' |
|
580 |
||
1604 | 581 |
'c' 'application/x-c-source' |
582 |
('cc' 'cpp') 'application/x-cpp-source' |
|
2479 | 583 |
'cs' 'application/x-csharp-source' |
1609 | 584 |
('h' 'hi') 'application/x-c-header' |
1604 | 585 |
('js' 'mocha') 'application/x-javascript' |
586 |
('java' 'jav') 'application/x-java-source' |
|
587 |
'sh' 'application/x-sh' |
|
588 |
'csh' 'application/x-csh' |
|
589 |
'tcl' 'application/x-tcl' |
|
590 |
'pl' 'application/x-perl' |
|
3020
3f9c74ff0975
changed: #applicationProgLangTypeList
Claus Gittinger <cg@exept.de>
parents:
3014
diff
changeset
|
591 |
'dart' 'application/x-dart' |
1604 | 592 |
'mak' 'application/x-make' |
593 |
'bat' 'application/x-batch-script' |
|
3008 | 594 |
('asn1' 'x409' 'gdmo' 'gdm') 'application/x-asn1-source' |
595 |
||
2912
f3466ea0810b
changed: #applicationProgLangTypeList
Claus Gittinger <cg@exept.de>
parents:
2911
diff
changeset
|
596 |
('lisp' 'lsp' 'scm' 'ss' |
f3466ea0810b
changed: #applicationProgLangTypeList
Claus Gittinger <cg@exept.de>
parents:
2911
diff
changeset
|
597 |
'arc' 'cl' 'brg') 'application/x-lisp-source' |
1604 | 598 |
) |
2298 | 599 |
|
3020
3f9c74ff0975
changed: #applicationProgLangTypeList
Claus Gittinger <cg@exept.de>
parents:
3014
diff
changeset
|
600 |
"Modified (comment): / 21-08-2012 / 20:55:13 / cg" |
1604 | 601 |
! |
1561 | 602 |
|
1604 | 603 |
applicationTextTypeList |
1606 | 604 |
"text applications" |
1604 | 605 |
|
606 |
^ #( |
|
607 |
('ps' 'eps') 'application/postscript' |
|
1778 | 608 |
"/ 'ai' 'application/postscript' |
1604 | 609 |
'pdf' 'application/pdf' |
610 |
'rtf' 'application/rtf' |
|
1778 | 611 |
"/ 'rtf' 'text/rtf' ???? |
3008 | 612 |
'ics' 'text/calendar' |
613 |
'doc' 'application/ms-word-document' |
|
1778 | 614 |
"/ 'doc' 'application/winword' |
615 |
'swf' 'application/x-shockwave-flash' |
|
616 |
('ppt' 'ppz' 'pot' 'pps') 'application/mspowerpoint' |
|
2028 | 617 |
'xls' 'application/x-excel' |
618 |
'slk' 'application/vnd.ms-excel' |
|
2911
7afaf1fdae8b
comment/format in: #mimeTypeForFilename:
Claus Gittinger <cg@exept.de>
parents:
2904
diff
changeset
|
619 |
'txt' 'text/plain' |
2970
8b91ec204044
comment/format in: #initialize
Claus Gittinger <cg@exept.de>
parents:
2968
diff
changeset
|
620 |
'xlsx' 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' |
1604 | 621 |
) |
2911
7afaf1fdae8b
comment/format in: #mimeTypeForFilename:
Claus Gittinger <cg@exept.de>
parents:
2904
diff
changeset
|
622 |
|
3008 | 623 |
"Modified: / 26-05-2012 / 15:27:30 / cg" |
1604 | 624 |
! |
625 |
||
626 |
applicationTypeList |
|
1606 | 627 |
"applications" |
1604 | 628 |
|
1729 | 629 |
|typeList| |
1180
c3309b30d14f
code cleanup & added mimeType aquire fallBack via OS
Claus Gittinger <cg@exept.de>
parents:
1023
diff
changeset
|
630 |
|
1729 | 631 |
typeList := OrderedCollection new. |
632 |
typeList addAll:self applicationProgLangTypeList. |
|
633 |
typeList addAll:self applicationTextTypeList. |
|
634 |
typeList addAll:self applicationCompressorsAndArchiveTypeList. |
|
635 |
typeList addAll:self applicationMiscTypeList. |
|
1616 | 636 |
|
1729 | 637 |
^ typeList |
1604 | 638 |
! |
639 |
||
640 |
audioTypeList |
|
1606 | 641 |
"audio formats ..." |
1180
c3309b30d14f
code cleanup & added mimeType aquire fallBack via OS
Claus Gittinger <cg@exept.de>
parents:
1023
diff
changeset
|
642 |
|
1604 | 643 |
^ #( |
1720 | 644 |
('au' 'snd') 'audio/basic' |
1778 | 645 |
('ra') 'audio/x-realaudio' |
646 |
('ram' 'rm') 'audio/x-pn-realaudio' |
|
1888
ef0f346b8f43
rpm suffix is RPM-package under unix (realplayer under windows)
Claus Gittinger <cg@exept.de>
parents:
1887
diff
changeset
|
647 |
"/ cg: see unixSpecific / windowsSpecific |
ef0f346b8f43
rpm suffix is RPM-package under unix (realplayer under windows)
Claus Gittinger <cg@exept.de>
parents:
1887
diff
changeset
|
648 |
"/ 'rpm' 'audio/x-pn-realaudio-plugin' |
3008 | 649 |
('mpa' 'mpega' 'mpga') 'audio/mpeg' |
1778 | 650 |
"/ 'mp3' 'audio/x-mp3' |
651 |
('mp3' 'mp2') 'audio/mpeg' |
|
1604 | 652 |
'wav' 'audio/x-wav' |
653 |
('aif' 'aiff' 'aifc') 'audio/x-aiff' |
|
1778 | 654 |
('midi' 'mid') 'audio/midi' |
1604 | 655 |
) |
3008 | 656 |
|
657 |
"Modified: / 26-05-2012 / 15:23:45 / cg" |
|
1604 | 658 |
! |
659 |
||
660 |
imageTypeList |
|
661 |
||
662 |
^ #( |
|
1180
c3309b30d14f
code cleanup & added mimeType aquire fallBack via OS
Claus Gittinger <cg@exept.de>
parents:
1023
diff
changeset
|
663 |
"/ image formats ... |
c3309b30d14f
code cleanup & added mimeType aquire fallBack via OS
Claus Gittinger <cg@exept.de>
parents:
1023
diff
changeset
|
664 |
|
1216 | 665 |
('jpg' 'jpeg') 'image/jpeg' |
1188 | 666 |
'gif' 'image/gif' |
667 |
('tif' 'tiff') 'image/tiff' |
|
3295 | 668 |
('xbm' 'bm') 'image/x-xbitmap' |
1188 | 669 |
'xpm' 'image/x-xpixmap' |
1720 | 670 |
'png' 'image/png' |
1188 | 671 |
'pcd' 'image/x-photo-cd' |
672 |
'bmp' 'image/x-MS-bmp' |
|
673 |
'rgb' 'image/x-rgb' |
|
674 |
'ppm' 'image/x-portable-pixmap' |
|
675 |
'pgm' 'image/x-portable-graymap' |
|
676 |
'pbm' 'image/x-portable-bitmap' |
|
677 |
'pnm' 'image/x-portable-anymap' |
|
678 |
'xwd' 'image/x-xwindowdump' |
|
679 |
'ras' 'image/x-cmu-raster' |
|
1216 | 680 |
'tga' 'image/x-targa' |
2020 | 681 |
'ico' 'image/x-ico' |
3380 | 682 |
'icns' 'image/icns' |
1604 | 683 |
) |
684 |
! |
|
1180
c3309b30d14f
code cleanup & added mimeType aquire fallBack via OS
Claus Gittinger <cg@exept.de>
parents:
1023
diff
changeset
|
685 |
|
1609 | 686 |
miscFilenameList |
3104 | 687 |
"other formats (not by suffix, but by fileName instead) ..." |
1609 | 688 |
|
689 |
^ #( |
|
2113 | 690 |
('makefile' 'make.proto' 'make.spec' 'nt.mak') 'application/x-make' |
2830 | 691 |
('exe' 'bin' 'com') 'application/octet-stream' |
2113 | 692 |
('class') 'application/octet-stream' |
2375 | 693 |
('top') 'application/x-waltop-digital-notepad' |
1609 | 694 |
) |
695 |
! |
|
696 |
||
1888
ef0f346b8f43
rpm suffix is RPM-package under unix (realplayer under windows)
Claus Gittinger <cg@exept.de>
parents:
1887
diff
changeset
|
697 |
osSpecificTypeList |
ef0f346b8f43
rpm suffix is RPM-package under unix (realplayer under windows)
Claus Gittinger <cg@exept.de>
parents:
1887
diff
changeset
|
698 |
OperatingSystem isMSWINDOWSlike ifTrue:[ |
ef0f346b8f43
rpm suffix is RPM-package under unix (realplayer under windows)
Claus Gittinger <cg@exept.de>
parents:
1887
diff
changeset
|
699 |
^ self windowsSpecificTypeList |
ef0f346b8f43
rpm suffix is RPM-package under unix (realplayer under windows)
Claus Gittinger <cg@exept.de>
parents:
1887
diff
changeset
|
700 |
]. |
ef0f346b8f43
rpm suffix is RPM-package under unix (realplayer under windows)
Claus Gittinger <cg@exept.de>
parents:
1887
diff
changeset
|
701 |
^ self unixSpecificTypeList |
2023 | 702 |
|
703 |
" |
|
704 |
self osSpecificTypeList |
|
705 |
" |
|
1888
ef0f346b8f43
rpm suffix is RPM-package under unix (realplayer under windows)
Claus Gittinger <cg@exept.de>
parents:
1887
diff
changeset
|
706 |
! |
ef0f346b8f43
rpm suffix is RPM-package under unix (realplayer under windows)
Claus Gittinger <cg@exept.de>
parents:
1887
diff
changeset
|
707 |
|
1604 | 708 |
textTypeList |
709 |
"/ misc text ... |
|
710 |
||
711 |
^ #( |
|
1887 | 712 |
('html' 'htm' 'shtml') 'text/html' |
1604 | 713 |
('txt' 'text') 'text/plain' |
1680 | 714 |
'xml' 'text/xml' |
1777 | 715 |
'css' 'text/css' |
2432 | 716 |
'csv' 'text/csv' |
1604 | 717 |
) |
718 |
! |
|
719 |
||
1888
ef0f346b8f43
rpm suffix is RPM-package under unix (realplayer under windows)
Claus Gittinger <cg@exept.de>
parents:
1887
diff
changeset
|
720 |
unixSpecificTypeList |
ef0f346b8f43
rpm suffix is RPM-package under unix (realplayer under windows)
Claus Gittinger <cg@exept.de>
parents:
1887
diff
changeset
|
721 |
|
ef0f346b8f43
rpm suffix is RPM-package under unix (realplayer under windows)
Claus Gittinger <cg@exept.de>
parents:
1887
diff
changeset
|
722 |
^ #( |
ef0f346b8f43
rpm suffix is RPM-package under unix (realplayer under windows)
Claus Gittinger <cg@exept.de>
parents:
1887
diff
changeset
|
723 |
"/ cg: RPM is 'audio/x-pn-realaudio-plugin' for WIN32 |
ef0f346b8f43
rpm suffix is RPM-package under unix (realplayer under windows)
Claus Gittinger <cg@exept.de>
parents:
1887
diff
changeset
|
724 |
"/ and 'application/x-rpm' for Unix |
ef0f346b8f43
rpm suffix is RPM-package under unix (realplayer under windows)
Claus Gittinger <cg@exept.de>
parents:
1887
diff
changeset
|
725 |
'rpm' 'application/x-rpm' |
ef0f346b8f43
rpm suffix is RPM-package under unix (realplayer under windows)
Claus Gittinger <cg@exept.de>
parents:
1887
diff
changeset
|
726 |
) |
ef0f346b8f43
rpm suffix is RPM-package under unix (realplayer under windows)
Claus Gittinger <cg@exept.de>
parents:
1887
diff
changeset
|
727 |
! |
ef0f346b8f43
rpm suffix is RPM-package under unix (realplayer under windows)
Claus Gittinger <cg@exept.de>
parents:
1887
diff
changeset
|
728 |
|
1604 | 729 |
videoTypeList |
730 |
"/ video formats ... |
|
731 |
||
732 |
^ #( |
|
1720 | 733 |
('qt' 'mov' 'moov') 'video/quicktime' |
734 |
('mpv' 'mpegv' 'mpg' 'mpeg' 'mpe') 'video/mpeg' |
|
1604 | 735 |
'movie' 'video/x-sgi-movie' |
1820 | 736 |
('avi' 'wmv' 'asf') 'video/x-msvideo' |
1604 | 737 |
('mpv2' 'mp2v' 'mp2' 'mpeg2') 'video/x-mpeg2' |
3367 | 738 |
('mp4') 'video/mp4' |
1680 | 739 |
'rm' 'application/vnd.rn-realmedia' |
740 |
'rv' 'video/x-pn-realvideo' |
|
3295 | 741 |
'fli' 'video/x-fli' |
3367 | 742 |
'flv' 'video/x-flv' "/ macromedia flash video |
1778 | 743 |
) |
1888
ef0f346b8f43
rpm suffix is RPM-package under unix (realplayer under windows)
Claus Gittinger <cg@exept.de>
parents:
1887
diff
changeset
|
744 |
! |
ef0f346b8f43
rpm suffix is RPM-package under unix (realplayer under windows)
Claus Gittinger <cg@exept.de>
parents:
1887
diff
changeset
|
745 |
|
ef0f346b8f43
rpm suffix is RPM-package under unix (realplayer under windows)
Claus Gittinger <cg@exept.de>
parents:
1887
diff
changeset
|
746 |
windowsSpecificTypeList |
ef0f346b8f43
rpm suffix is RPM-package under unix (realplayer under windows)
Claus Gittinger <cg@exept.de>
parents:
1887
diff
changeset
|
747 |
^ #( |
ef0f346b8f43
rpm suffix is RPM-package under unix (realplayer under windows)
Claus Gittinger <cg@exept.de>
parents:
1887
diff
changeset
|
748 |
"/ cg: RPM is 'audio/x-pn-realaudio-plugin' for WIN32 |
ef0f346b8f43
rpm suffix is RPM-package under unix (realplayer under windows)
Claus Gittinger <cg@exept.de>
parents:
1887
diff
changeset
|
749 |
"/ and 'application/x-rpm' for Unix |
ef0f346b8f43
rpm suffix is RPM-package under unix (realplayer under windows)
Claus Gittinger <cg@exept.de>
parents:
1887
diff
changeset
|
750 |
'rpm' 'audio/x-pn-realaudio-plugin' |
ef0f346b8f43
rpm suffix is RPM-package under unix (realplayer under windows)
Claus Gittinger <cg@exept.de>
parents:
1887
diff
changeset
|
751 |
) |
643 | 752 |
! ! |
753 |
||
1729 | 754 |
!MIMETypes class methodsFor:'obsolete'! |
1489 | 755 |
|
2491
831417cc1e5b
Change bas spelling: parentesis to good spellinge parenthesis
Stefan Vogel <sv@exept.de>
parents:
2490
diff
changeset
|
756 |
defaultCommandForMimeType:mimeType |
831417cc1e5b
Change bas spelling: parentesis to good spellinge parenthesis
Stefan Vogel <sv@exept.de>
parents:
2490
diff
changeset
|
757 |
<resource: #obsolete> |
831417cc1e5b
Change bas spelling: parentesis to good spellinge parenthesis
Stefan Vogel <sv@exept.de>
parents:
2490
diff
changeset
|
758 |
self obsoleteMethodWarning:'use #defaultCommandTemplateToOpenMimeType:'. |
831417cc1e5b
Change bas spelling: parentesis to good spellinge parenthesis
Stefan Vogel <sv@exept.de>
parents:
2490
diff
changeset
|
759 |
|
831417cc1e5b
Change bas spelling: parentesis to good spellinge parenthesis
Stefan Vogel <sv@exept.de>
parents:
2490
diff
changeset
|
760 |
^ self defaultCommandTemplateToOpenMimeType:mimeType |
831417cc1e5b
Change bas spelling: parentesis to good spellinge parenthesis
Stefan Vogel <sv@exept.de>
parents:
2490
diff
changeset
|
761 |
|
831417cc1e5b
Change bas spelling: parentesis to good spellinge parenthesis
Stefan Vogel <sv@exept.de>
parents:
2490
diff
changeset
|
762 |
" |
2758
66e62ceecb67
comment/format in: #defaultCommandForMimeType:
Claus Gittinger <cg@exept.de>
parents:
2724
diff
changeset
|
763 |
MIMETypes defaultCommandTemplateToOpenMimeType:'application/pdf' |
2491
831417cc1e5b
Change bas spelling: parentesis to good spellinge parenthesis
Stefan Vogel <sv@exept.de>
parents:
2490
diff
changeset
|
764 |
" |
831417cc1e5b
Change bas spelling: parentesis to good spellinge parenthesis
Stefan Vogel <sv@exept.de>
parents:
2490
diff
changeset
|
765 |
|
831417cc1e5b
Change bas spelling: parentesis to good spellinge parenthesis
Stefan Vogel <sv@exept.de>
parents:
2490
diff
changeset
|
766 |
"Created: / 12-05-2004 / 11:09:22 / cg" |
831417cc1e5b
Change bas spelling: parentesis to good spellinge parenthesis
Stefan Vogel <sv@exept.de>
parents:
2490
diff
changeset
|
767 |
"Modified: / 12-05-2004 / 11:16:53 / cg" |
831417cc1e5b
Change bas spelling: parentesis to good spellinge parenthesis
Stefan Vogel <sv@exept.de>
parents:
2490
diff
changeset
|
768 |
! |
831417cc1e5b
Change bas spelling: parentesis to good spellinge parenthesis
Stefan Vogel <sv@exept.de>
parents:
2490
diff
changeset
|
769 |
|
1729 | 770 |
fontForCharset:aCharSetName |
771 |
"return the font-encoding for an iso-charset" |
|
1489 | 772 |
|
1981 | 773 |
<resource:#obsolete> |
1729 | 774 |
self obsoleteMethodWarning:'use FontDescription >> fontNamePatternForCharset:'. |
775 |
^ FontDescription fontNamePatternForCharset:aCharSetName. |
|
1489 | 776 |
|
777 |
" |
|
1729 | 778 |
MIMETypes fontForCharset:'iso2022-jp' |
779 |
MIMETypes fontForCharset:'euc-jp' |
|
1472 | 780 |
" |
781 |
||
1729 | 782 |
"Modified: / 1.8.1998 / 17:00:57 / cg" |
783 |
! ! |
|
1472 | 784 |
|
1729 | 785 |
!MIMETypes class methodsFor:'queries'! |
1472 | 786 |
|
647 | 787 |
defineImageType:mimeType suffix:aSuffix reader:aReaderClass |
788 |
"register an image reader." |
|
789 |
||
790 |
aSuffix notNil ifTrue:[ |
|
791 |
self imageReaderForSuffix:aSuffix put:aReaderClass. |
|
792 |
]. |
|
793 |
||
794 |
mimeType notNil ifTrue:[ |
|
795 |
self imageReaderForType:mimeType put:aReaderClass |
|
796 |
]. |
|
797 |
||
798 |
(aSuffix notNil and:[mimeType notNil]) ifTrue:[ |
|
799 |
self mimeTypeForSuffix:aSuffix put:mimeType |
|
800 |
]. |
|
801 |
! |
|
802 |
||
3359 | 803 |
fileInfoForMimeType:mimeType |
804 |
"given a mimeType, return an info string similar to what the unix 'file' command |
|
805 |
provides. This info here is returned by systems which have no file (i.e. MSDOS) and |
|
806 |
for types of which file does not know about (smalltalk files, for example)" |
|
807 |
||
808 |
^ TypeToInfoMapping at:mimeType ifAbsent:nil |
|
809 |
||
810 |
" |
|
811 |
self fileInfoForMimeType:(MIMEType fromString:'image/gif') |
|
812 |
" |
|
813 |
! |
|
814 |
||
643 | 815 |
fileSuffixToImageReaderMapping |
1021 | 816 |
"return the suffix-to-imageReader mapping" |
817 |
||
643 | 818 |
^ FileSuffixToImageReaderClassMapping ? #() |
819 |
||
1021 | 820 |
"Modified: / 1.8.1998 / 17:00:11 / cg" |
643 | 821 |
! |
822 |
||
823 |
imageFileSuffixes |
|
1021 | 824 |
"return a collection with known file suffixes" |
825 |
||
643 | 826 |
FileSuffixToImageReaderClassMapping isNil ifTrue:[^ #()]. |
827 |
^ FileSuffixToImageReaderClassMapping keys |
|
828 |
||
1021 | 829 |
"Created: / 30.6.1997 / 22:04:48 / cg" |
830 |
"Modified: / 1.8.1998 / 17:01:26 / cg" |
|
643 | 831 |
! |
832 |
||
3014
e6d9a204da08
comment/format in: #mimeTypeForFilename:
Claus Gittinger <cg@exept.de>
parents:
3012
diff
changeset
|
833 |
mimeTypeForFilename:filenameOrString |
1272
91ba4078b690
additional mime table for filenames without suffix.
Claus Gittinger <cg@exept.de>
parents:
1269
diff
changeset
|
834 |
"given a filename, return the mime-type or nil, if unknown" |
91ba4078b690
additional mime table for filenames without suffix.
Claus Gittinger <cg@exept.de>
parents:
1269
diff
changeset
|
835 |
|
1780
ba94d562efe8
support double-suffix such as '.tar.gz'
Claus Gittinger <cg@exept.de>
parents:
1779
diff
changeset
|
836 |
|type filename lcFilename suff suff2| |
1272
91ba4078b690
additional mime table for filenames without suffix.
Claus Gittinger <cg@exept.de>
parents:
1269
diff
changeset
|
837 |
|
3014
e6d9a204da08
comment/format in: #mimeTypeForFilename:
Claus Gittinger <cg@exept.de>
parents:
3012
diff
changeset
|
838 |
filename := filenameOrString asFilename. |
1474 | 839 |
|
840 |
lcFilename := filename baseName asLowercase. |
|
1272
91ba4078b690
additional mime table for filenames without suffix.
Claus Gittinger <cg@exept.de>
parents:
1269
diff
changeset
|
841 |
type := FilenameToTypeMapping at:lcFilename ifAbsent:nil. |
91ba4078b690
additional mime table for filenames without suffix.
Claus Gittinger <cg@exept.de>
parents:
1269
diff
changeset
|
842 |
type isNil ifTrue:[ |
91ba4078b690
additional mime table for filenames without suffix.
Claus Gittinger <cg@exept.de>
parents:
1269
diff
changeset
|
843 |
"/ allow for fallback ... |
91ba4078b690
additional mime table for filenames without suffix.
Claus Gittinger <cg@exept.de>
parents:
1269
diff
changeset
|
844 |
type := OperatingSystem mimeTypeForFilename:lcFilename. |
91ba4078b690
additional mime table for filenames without suffix.
Claus Gittinger <cg@exept.de>
parents:
1269
diff
changeset
|
845 |
"/ the special value #unknown is returned as nil; |
91ba4078b690
additional mime table for filenames without suffix.
Claus Gittinger <cg@exept.de>
parents:
1269
diff
changeset
|
846 |
"/ this avoids constant retry if a mimeType is not known in |
91ba4078b690
additional mime table for filenames without suffix.
Claus Gittinger <cg@exept.de>
parents:
1269
diff
changeset
|
847 |
"/ the OS. |
1275 | 848 |
"/ type isNil ifTrue:[ |
849 |
"/ FilenameToTypeMapping at:lcFilename put:#unknown |
|
850 |
"/ ]. |
|
1272
91ba4078b690
additional mime table for filenames without suffix.
Claus Gittinger <cg@exept.de>
parents:
1269
diff
changeset
|
851 |
]. |
91ba4078b690
additional mime table for filenames without suffix.
Claus Gittinger <cg@exept.de>
parents:
1269
diff
changeset
|
852 |
|
91ba4078b690
additional mime table for filenames without suffix.
Claus Gittinger <cg@exept.de>
parents:
1269
diff
changeset
|
853 |
type == #unknown ifTrue:[ |
91ba4078b690
additional mime table for filenames without suffix.
Claus Gittinger <cg@exept.de>
parents:
1269
diff
changeset
|
854 |
type := nil. |
91ba4078b690
additional mime table for filenames without suffix.
Claus Gittinger <cg@exept.de>
parents:
1269
diff
changeset
|
855 |
]. |
1273
7a52d4bcdb10
filenames mime query falls back to suffix query.
Claus Gittinger <cg@exept.de>
parents:
1272
diff
changeset
|
856 |
|
7a52d4bcdb10
filenames mime query falls back to suffix query.
Claus Gittinger <cg@exept.de>
parents:
1272
diff
changeset
|
857 |
type isNil ifTrue:[ |
1473 | 858 |
suff := filename suffix. |
1273
7a52d4bcdb10
filenames mime query falls back to suffix query.
Claus Gittinger <cg@exept.de>
parents:
1272
diff
changeset
|
859 |
suff size ~~ 0 ifTrue:[ |
1780
ba94d562efe8
support double-suffix such as '.tar.gz'
Claus Gittinger <cg@exept.de>
parents:
1779
diff
changeset
|
860 |
"/ sigh - special code for multiple-suffices... |
ba94d562efe8
support double-suffix such as '.tar.gz'
Claus Gittinger <cg@exept.de>
parents:
1779
diff
changeset
|
861 |
"/ .tar.gz -> tgz |
ba94d562efe8
support double-suffix such as '.tar.gz'
Claus Gittinger <cg@exept.de>
parents:
1779
diff
changeset
|
862 |
suff2 := filename withoutSuffix suffix. |
ba94d562efe8
support double-suffix such as '.tar.gz'
Claus Gittinger <cg@exept.de>
parents:
1779
diff
changeset
|
863 |
suff2 size > 0 ifTrue:[ |
ba94d562efe8
support double-suffix such as '.tar.gz'
Claus Gittinger <cg@exept.de>
parents:
1779
diff
changeset
|
864 |
type := self mimeTypeForSuffix:(suff2 , '.' , suff). |
ba94d562efe8
support double-suffix such as '.tar.gz'
Claus Gittinger <cg@exept.de>
parents:
1779
diff
changeset
|
865 |
]. |
ba94d562efe8
support double-suffix such as '.tar.gz'
Claus Gittinger <cg@exept.de>
parents:
1779
diff
changeset
|
866 |
type isNil ifTrue:[ |
ba94d562efe8
support double-suffix such as '.tar.gz'
Claus Gittinger <cg@exept.de>
parents:
1779
diff
changeset
|
867 |
type := self mimeTypeForSuffix:suff |
ba94d562efe8
support double-suffix such as '.tar.gz'
Claus Gittinger <cg@exept.de>
parents:
1779
diff
changeset
|
868 |
]. |
1273
7a52d4bcdb10
filenames mime query falls back to suffix query.
Claus Gittinger <cg@exept.de>
parents:
1272
diff
changeset
|
869 |
] |
7a52d4bcdb10
filenames mime query falls back to suffix query.
Claus Gittinger <cg@exept.de>
parents:
1272
diff
changeset
|
870 |
]. |
7a52d4bcdb10
filenames mime query falls back to suffix query.
Claus Gittinger <cg@exept.de>
parents:
1272
diff
changeset
|
871 |
|
1272
91ba4078b690
additional mime table for filenames without suffix.
Claus Gittinger <cg@exept.de>
parents:
1269
diff
changeset
|
872 |
^ type |
1780
ba94d562efe8
support double-suffix such as '.tar.gz'
Claus Gittinger <cg@exept.de>
parents:
1779
diff
changeset
|
873 |
|
ba94d562efe8
support double-suffix such as '.tar.gz'
Claus Gittinger <cg@exept.de>
parents:
1779
diff
changeset
|
874 |
" |
2820 | 875 |
MIMETypes mimeTypeForFilename:'typeinst.dvi' |
876 |
MIMETypes mimeTypeForFilename:'foo.tar' |
|
877 |
MIMETypes mimeTypeForFilename:'foo.tgz' |
|
878 |
MIMETypes mimeTypeForFilename:'foo.tar.gz' |
|
2911
7afaf1fdae8b
comment/format in: #mimeTypeForFilename:
Claus Gittinger <cg@exept.de>
parents:
2904
diff
changeset
|
879 |
MIMETypes mimeTypeForFilename:'foo.txt' |
1780
ba94d562efe8
support double-suffix such as '.tar.gz'
Claus Gittinger <cg@exept.de>
parents:
1779
diff
changeset
|
880 |
" |
2911
7afaf1fdae8b
comment/format in: #mimeTypeForFilename:
Claus Gittinger <cg@exept.de>
parents:
2904
diff
changeset
|
881 |
|
7afaf1fdae8b
comment/format in: #mimeTypeForFilename:
Claus Gittinger <cg@exept.de>
parents:
2904
diff
changeset
|
882 |
"Modified: / 10-05-2011 / 11:55:18 / cg" |
3014
e6d9a204da08
comment/format in: #mimeTypeForFilename:
Claus Gittinger <cg@exept.de>
parents:
3012
diff
changeset
|
883 |
"Modified (format): / 28-07-2012 / 09:39:15 / cg" |
1272
91ba4078b690
additional mime table for filenames without suffix.
Claus Gittinger <cg@exept.de>
parents:
1269
diff
changeset
|
884 |
! |
91ba4078b690
additional mime table for filenames without suffix.
Claus Gittinger <cg@exept.de>
parents:
1269
diff
changeset
|
885 |
|
91ba4078b690
additional mime table for filenames without suffix.
Claus Gittinger <cg@exept.de>
parents:
1269
diff
changeset
|
886 |
mimeTypeForFilename:filename put:mimeType |
91ba4078b690
additional mime table for filenames without suffix.
Claus Gittinger <cg@exept.de>
parents:
1269
diff
changeset
|
887 |
"register a mime type for a filename" |
91ba4078b690
additional mime table for filenames without suffix.
Claus Gittinger <cg@exept.de>
parents:
1269
diff
changeset
|
888 |
|
91ba4078b690
additional mime table for filenames without suffix.
Claus Gittinger <cg@exept.de>
parents:
1269
diff
changeset
|
889 |
FilenameToTypeMapping isNil ifTrue:[ |
91ba4078b690
additional mime table for filenames without suffix.
Claus Gittinger <cg@exept.de>
parents:
1269
diff
changeset
|
890 |
FilenameToTypeMapping := Dictionary new |
91ba4078b690
additional mime table for filenames without suffix.
Claus Gittinger <cg@exept.de>
parents:
1269
diff
changeset
|
891 |
]. |
1612 | 892 |
FilenameToTypeMapping at:filename put:(MIMEType fromString:mimeType asLowercase) |
1611 | 893 |
! |
894 |
||
643 | 895 |
mimeTypeForSuffix:suffix |
1021 | 896 |
"given a file suffix, return the mime-type" |
897 |
||
1180
c3309b30d14f
code cleanup & added mimeType aquire fallBack via OS
Claus Gittinger <cg@exept.de>
parents:
1023
diff
changeset
|
898 |
|type lcSuffix| |
c3309b30d14f
code cleanup & added mimeType aquire fallBack via OS
Claus Gittinger <cg@exept.de>
parents:
1023
diff
changeset
|
899 |
|
1837 | 900 |
suffix = LastSuffix ifTrue:[ |
901 |
^ LastType |
|
902 |
]. |
|
903 |
||
1180
c3309b30d14f
code cleanup & added mimeType aquire fallBack via OS
Claus Gittinger <cg@exept.de>
parents:
1023
diff
changeset
|
904 |
lcSuffix := suffix asLowercase. |
1837 | 905 |
type := FileSuffixToTypeMapping at:lcSuffix ifAbsent:nil. |
906 |
type isNil ifTrue:[ |
|
907 |
"/ allow for fallback ... |
|
908 |
type := OperatingSystem mimeTypeForSuffix:lcSuffix. |
|
909 |
"/ the special value #unknown is returned as nil; |
|
910 |
"/ this avoids constant retry if a mimeType is not known in the OS. |
|
911 |
||
912 |
type := type ? #unknown. |
|
913 |
FileSuffixToTypeMapping at:lcSuffix put:type. |
|
1180
c3309b30d14f
code cleanup & added mimeType aquire fallBack via OS
Claus Gittinger <cg@exept.de>
parents:
1023
diff
changeset
|
914 |
]. |
1837 | 915 |
|
1180
c3309b30d14f
code cleanup & added mimeType aquire fallBack via OS
Claus Gittinger <cg@exept.de>
parents:
1023
diff
changeset
|
916 |
type == #unknown ifTrue:[ |
1837 | 917 |
type := nil. |
1180
c3309b30d14f
code cleanup & added mimeType aquire fallBack via OS
Claus Gittinger <cg@exept.de>
parents:
1023
diff
changeset
|
918 |
]. |
1840 | 919 |
type notNil ifTrue:[ |
920 |
LastSuffix := suffix. |
|
921 |
LastType := MIMEType fromString:type. |
|
922 |
^ LastType |
|
923 |
]. |
|
1841 | 924 |
^ type |
643 | 925 |
|
1666 | 926 |
" |
1840 | 927 |
self mimeTypeForSuffix:'gif' |
1888
ef0f346b8f43
rpm suffix is RPM-package under unix (realplayer under windows)
Claus Gittinger <cg@exept.de>
parents:
1887
diff
changeset
|
928 |
self mimeTypeForSuffix:'rpm' |
2891 | 929 |
self mimeTypeForSuffix:'zip' |
1666 | 930 |
" |
931 |
||
2891 | 932 |
"Created: / 30-06-1997 / 21:55:51 / cg" |
933 |
"Modified: / 14-02-2011 / 17:14:34 / cg" |
|
643 | 934 |
! |
935 |
||
936 |
mimeTypeForSuffix:suffix put:mimeType |
|
1021 | 937 |
"register a mime type for a file suffix" |
938 |
||
643 | 939 |
FileSuffixToTypeMapping isNil ifTrue:[ |
940 |
FileSuffixToTypeMapping := Dictionary new |
|
941 |
]. |
|
942 |
FileSuffixToTypeMapping at:suffix put:mimeType asLowercase |
|
943 |
||
1021 | 944 |
"Created: / 30.6.1997 / 21:56:20 / cg" |
945 |
"Modified: / 1.8.1998 / 17:03:18 / cg" |
|
1593 | 946 |
! |
947 |
||
948 |
mimeTypeForSuffixMapping |
|
949 |
||
950 |
^ FileSuffixToTypeMapping |
|
1611 | 951 |
! |
952 |
||
2023 | 953 |
mimeTypeFromString:mimeTypeString |
954 |
"given a mime-type for a string" |
|
955 |
||
956 |
^ MIMEType fromString:mimeTypeString |
|
957 |
||
958 |
" |
|
959 |
self mimeTypeFromString:'image/gif' |
|
2487
eaa224da42fa
mimeType: x-expecco-testsuite (extension: ets)
Claus Gittinger <cg@exept.de>
parents:
2486
diff
changeset
|
960 |
self mimeTypeFromString:'application/x-expecco-testsuite' |
2023 | 961 |
" |
962 |
! |
|
963 |
||
1611 | 964 |
mimeTypeOfContents:filename |
965 |
"given a filename, scan the contents, return the mime-type or nil, if unknown" |
|
966 |
||
1612 | 967 |
|typeString| |
968 |
||
969 |
typeString := filename mimeTypeOfContents. |
|
970 |
typeString isNil ifTrue:[^ nil]. |
|
971 |
^ MIMEType fromString:typeString. |
|
1887 | 972 |
! |
973 |
||
2582
298203fdb64d
mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents:
2570
diff
changeset
|
974 |
mimeTypeOfData:someData |
298203fdb64d
mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents:
2570
diff
changeset
|
975 |
"this tries to guess the mime type of contents of someData. |
298203fdb64d
mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents:
2570
diff
changeset
|
976 |
Returns nil, if unknown. |
298203fdb64d
mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents:
2570
diff
changeset
|
977 |
This is done using some heuristics, and may need some improvement" |
298203fdb64d
mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents:
2570
diff
changeset
|
978 |
|
298203fdb64d
mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents:
2570
diff
changeset
|
979 |
|buffer lcBuffer size idx idx2| |
298203fdb64d
mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents:
2570
diff
changeset
|
980 |
|
2583 | 981 |
someData isEmptyOrNil ifTrue:[^ nil]. |
982 |
||
983 |
size := 2048 min:someData size. |
|
2582
298203fdb64d
mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents:
2570
diff
changeset
|
984 |
|
298203fdb64d
mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents:
2570
diff
changeset
|
985 |
"/ read some data from the file ... |
2583 | 986 |
buffer := (someData copyTo:size) asString. |
2582
298203fdb64d
mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents:
2570
diff
changeset
|
987 |
lcBuffer := buffer asLowercase. |
298203fdb64d
mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents:
2570
diff
changeset
|
988 |
|
298203fdb64d
mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents:
2570
diff
changeset
|
989 |
(idx := lcBuffer findString:'mimetype:') ~~ 0 ifTrue:[ |
298203fdb64d
mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents:
2570
diff
changeset
|
990 |
idx := idx + 'mimetype:' size. |
298203fdb64d
mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents:
2570
diff
changeset
|
991 |
idx := lcBuffer indexOfNonSeparatorStartingAt:idx. |
298203fdb64d
mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents:
2570
diff
changeset
|
992 |
idx2 := lcBuffer indexOfSeparatorStartingAt:idx. |
298203fdb64d
mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents:
2570
diff
changeset
|
993 |
idx2 > idx ifTrue:[ |
2583 | 994 |
^ MIMEType fromString:(lcBuffer copyFrom:idx to:idx2-1) |
2582
298203fdb64d
mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents:
2570
diff
changeset
|
995 |
]. |
298203fdb64d
mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents:
2570
diff
changeset
|
996 |
]. |
298203fdb64d
mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents:
2570
diff
changeset
|
997 |
|
2924 | 998 |
"/ real starters |
2582
298203fdb64d
mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents:
2570
diff
changeset
|
999 |
#( |
298203fdb64d
mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents:
2570
diff
changeset
|
1000 |
( #[16r4C 16r00 16r00 16r00 16r01 16r14 16r02 16r00 16r00 16r00 16r00 16r00 16rC0 16r00 16r00 16r00 16r00 16r00 16r00 16r46] |
298203fdb64d
mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents:
2570
diff
changeset
|
1001 |
#'application/x-ms-shortcut' ) |
2924 | 1002 |
( 'ITOLITLS' |
1003 |
#'application/x-ms-reader' ) |
|
2582
298203fdb64d
mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents:
2570
diff
changeset
|
1004 |
( 'WALTOP' |
298203fdb64d
mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents:
2570
diff
changeset
|
1005 |
#'application/x-waltop-digital-notepad' ) |
2892 | 1006 |
('PK' |
1007 |
#'application/x-zip-compressed') |
|
3113 | 1008 |
('<?xml' |
1009 |
#'text/xml') |
|
2582
298203fdb64d
mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents:
2570
diff
changeset
|
1010 |
) pairsDo:[:pattern :what | |
298203fdb64d
mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents:
2570
diff
changeset
|
1011 |
|patternString| |
298203fdb64d
mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents:
2570
diff
changeset
|
1012 |
|
298203fdb64d
mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents:
2570
diff
changeset
|
1013 |
patternString := pattern asString. |
298203fdb64d
mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents:
2570
diff
changeset
|
1014 |
(buffer startsWith:patternString) ifTrue:[ |
2583 | 1015 |
^ MIMEType fromString:what |
2582
298203fdb64d
mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents:
2570
diff
changeset
|
1016 |
] |
298203fdb64d
mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents:
2570
diff
changeset
|
1017 |
]. |
298203fdb64d
mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents:
2570
diff
changeset
|
1018 |
|
2924 | 1019 |
"/ somewhere near the beginning |
2582
298203fdb64d
mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents:
2570
diff
changeset
|
1020 |
#( |
298203fdb64d
mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents:
2570
diff
changeset
|
1021 |
('<body:' #'text/html') |
298203fdb64d
mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents:
2570
diff
changeset
|
1022 |
('%!!ps-adobe' #'application/postscript') |
298203fdb64d
mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents:
2570
diff
changeset
|
1023 |
('%PDF-' #'application/pdf') |
298203fdb64d
mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents:
2570
diff
changeset
|
1024 |
('#!! /bin/sh' #'application/x-sh') |
298203fdb64d
mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents:
2570
diff
changeset
|
1025 |
('#!!/bin/sh' #'application/x-sh') |
298203fdb64d
mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents:
2570
diff
changeset
|
1026 |
"/ ('#!! /bin/bash' 'application/x-bash') |
298203fdb64d
mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents:
2570
diff
changeset
|
1027 |
"/ ('#!!/bin/bash' 'application/x-bash') |
298203fdb64d
mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents:
2570
diff
changeset
|
1028 |
|
3113 | 1029 |
('---- encoding: ' #'application/x-smalltalk-source') |
1030 |
('---- timestamp ' #'application/x-smalltalk-source') |
|
2582
298203fdb64d
mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents:
2570
diff
changeset
|
1031 |
('from dolphin' #'application/x-smalltalk-source') |
298203fdb64d
mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents:
2570
diff
changeset
|
1032 |
('from visualworks' #'application/x-smalltalk-source') |
3359 | 1033 |
('from squeak' #'application/x-smalltalk-source') |
1034 |
('from smalltalk/x' #'application/x-smalltalk-source') |
|
1035 |
('"{ Package:' #'application(x-smalltalk-source') |
|
2582
298203fdb64d
mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents:
2570
diff
changeset
|
1036 |
('categoriesforclass' #'application/x-smalltalk-source') |
298203fdb64d
mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents:
2570
diff
changeset
|
1037 |
('methodsfor!!' #'application/x-smalltalk-source') |
298203fdb64d
mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents:
2570
diff
changeset
|
1038 |
('subclass:' #'application/x-smalltalk-source') |
298203fdb64d
mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents:
2570
diff
changeset
|
1039 |
('methodsfor:' #'application/x-smalltalk-source') |
298203fdb64d
mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents:
2570
diff
changeset
|
1040 |
('interchangeversion:' #'application/x-smalltalk-source-sif') |
298203fdb64d
mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents:
2570
diff
changeset
|
1041 |
('subclass:' #'application/x-smalltalk-source') |
298203fdb64d
mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents:
2570
diff
changeset
|
1042 |
('methodsfor:' #'application/x-smalltalk-source') |
3332 | 1043 |
('Application create:' #'application/x-smalltalk-source') |
1044 |
('becomeDefault!!' #'application/x-smalltalk-source') |
|
2582
298203fdb64d
mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents:
2570
diff
changeset
|
1045 |
|
298203fdb64d
mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents:
2570
diff
changeset
|
1046 |
) pairsDo:[:pattern :what | |
298203fdb64d
mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents:
2570
diff
changeset
|
1047 |
(lcBuffer findString:pattern) ~~ 0 ifTrue:[ |
2583 | 1048 |
^ MIMEType fromString:what |
2582
298203fdb64d
mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents:
2570
diff
changeset
|
1049 |
] |
298203fdb64d
mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents:
2570
diff
changeset
|
1050 |
]. |
298203fdb64d
mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents:
2570
diff
changeset
|
1051 |
|
298203fdb64d
mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents:
2570
diff
changeset
|
1052 |
(idx := lcBuffer findString:'<h') ~~ 0 ifTrue:[ |
298203fdb64d
mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents:
2570
diff
changeset
|
1053 |
((lcBuffer continuesWith:'<head' startingAt:idx) |
298203fdb64d
mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents:
2570
diff
changeset
|
1054 |
or:[(lcBuffer continuesWith:'<html' startingAt:idx) |
298203fdb64d
mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents:
2570
diff
changeset
|
1055 |
or:[(lcBuffer continuesWith:'<h1' startingAt:idx) |
298203fdb64d
mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents:
2570
diff
changeset
|
1056 |
or:[(lcBuffer continuesWith:'<h2' startingAt:idx) |
298203fdb64d
mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents:
2570
diff
changeset
|
1057 |
or:[(lcBuffer continuesWith:'<h3' startingAt:idx) |
298203fdb64d
mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents:
2570
diff
changeset
|
1058 |
or:[(lcBuffer continuesWith:'<h4' startingAt:idx) |
298203fdb64d
mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents:
2570
diff
changeset
|
1059 |
or:[(lcBuffer continuesWith:'<h5' startingAt:idx) |
298203fdb64d
mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents:
2570
diff
changeset
|
1060 |
or:[(lcBuffer continuesWith:'<h6' startingAt:idx)]]]]]]]) |
298203fdb64d
mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents:
2570
diff
changeset
|
1061 |
ifTrue:[ |
2583 | 1062 |
^ MIMEType fromString:'text/html' |
2582
298203fdb64d
mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents:
2570
diff
changeset
|
1063 |
] |
298203fdb64d
mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents:
2570
diff
changeset
|
1064 |
]. |
298203fdb64d
mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents:
2570
diff
changeset
|
1065 |
|
298203fdb64d
mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents:
2570
diff
changeset
|
1066 |
[size ~~ 0 and:[(buffer at:size) isPrintable]] whileTrue:[size := size - 1]. |
298203fdb64d
mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents:
2570
diff
changeset
|
1067 |
|
298203fdb64d
mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents:
2570
diff
changeset
|
1068 |
size == 0 ifTrue:[ |
2583 | 1069 |
^ MIMEType fromString:'text/plain' |
2582
298203fdb64d
mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents:
2570
diff
changeset
|
1070 |
]. |
298203fdb64d
mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents:
2570
diff
changeset
|
1071 |
^ nil |
2891 | 1072 |
|
2924 | 1073 |
"Modified: / 12-07-2011 / 19:08:17 / cg" |
2582
298203fdb64d
mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents:
2570
diff
changeset
|
1074 |
! |
298203fdb64d
mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents:
2570
diff
changeset
|
1075 |
|
1887 | 1076 |
suffixForMimeType:mimeType |
1077 |
"given a file suffix, return the mime-type" |
|
1078 |
||
1079 |
^ TypeToFileSuffixMapping at:mimeType ifAbsent:nil |
|
1080 |
||
1081 |
" |
|
1082 |
self suffixForMimeType:(MIMEType fromString:'image/gif') |
|
1083 |
" |
|
1084 |
||
1085 |
"Created: / 30.6.1997 / 21:55:51 / cg" |
|
1086 |
"Modified: / 23.12.1999 / 22:30:55 / cg" |
|
1087 |
! |
|
1088 |
||
1089 |
suffixForMimeTypeString:mimeTypeString |
|
1090 |
"given a file suffix, return the mime-type" |
|
1091 |
||
1092 |
^ self suffixForMimeType:(MIMEType fromString:mimeTypeString) |
|
1093 |
||
1094 |
" |
|
1095 |
self suffixForMimeTypeString:'image/gif' |
|
1096 |
" |
|
1097 |
||
1098 |
"Created: / 30.6.1997 / 21:55:51 / cg" |
|
1099 |
"Modified: / 23.12.1999 / 22:30:55 / cg" |
|
1612 | 1100 |
! ! |
1101 |
||
2116 | 1102 |
!MIMETypes class methodsFor:'queries-applications'! |
1103 |
||
2117 | 1104 |
defaultCommandPerMIME |
1105 |
"returns the collection which is used to map MIME-type to command-templates." |
|
1106 |
||
1107 |
"TODO: move this to OS/UserPreferences" |
|
1108 |
||
1109 |
DefaultCommandPerMIMEPerOS isNil ifTrue:[ |
|
1110 |
self initializeDefaultCommands |
|
1111 |
]. |
|
1112 |
OperatingSystem isUNIXlike ifTrue:[ |
|
1113 |
^ DefaultCommandPerMIMEPerOS at:#unix |
|
1114 |
]. |
|
1115 |
^ DefaultCommandPerMIMEPerOS at:#win32 |
|
2942
693d381bc775
comment/format in: #defaultCommandPerMIME
Claus Gittinger <cg@exept.de>
parents:
2937
diff
changeset
|
1116 |
|
693d381bc775
comment/format in: #defaultCommandPerMIME
Claus Gittinger <cg@exept.de>
parents:
2937
diff
changeset
|
1117 |
" |
693d381bc775
comment/format in: #defaultCommandPerMIME
Claus Gittinger <cg@exept.de>
parents:
2937
diff
changeset
|
1118 |
MIMETypes defaultCommandPerMIME |
693d381bc775
comment/format in: #defaultCommandPerMIME
Claus Gittinger <cg@exept.de>
parents:
2937
diff
changeset
|
1119 |
" |
693d381bc775
comment/format in: #defaultCommandPerMIME
Claus Gittinger <cg@exept.de>
parents:
2937
diff
changeset
|
1120 |
|
693d381bc775
comment/format in: #defaultCommandPerMIME
Claus Gittinger <cg@exept.de>
parents:
2937
diff
changeset
|
1121 |
"Modified (comment): / 16-09-2011 / 16:20:12 / cg" |
2117 | 1122 |
! |
1123 |
||
2116 | 1124 |
defaultCommandTemplateToOpenMimeType:mimeType |
1125 |
|cmd| |
|
1126 |
||
1127 |
cmd := self defaultCommandPerMIME at:mimeType ifAbsent:nil. |
|
1128 |
cmd isNil ifTrue:[ |
|
1129 |
OperatingSystem isMSWINDOWSlike ifTrue:[ |
|
1130 |
cmd := Win32OperatingSystem::RegistryEntry commandTemplateToOpenMimeType:mimeType |
|
1131 |
]. |
|
1132 |
]. |
|
1133 |
^ cmd |
|
1134 |
||
1135 |
" |
|
1136 |
MIMETypes defaultCommandTemplateToOpenMimeType:'application/pdf' |
|
2118 | 1137 |
MIMETypes defaultCommandTemplateToOpenMimeType:'text/html' |
2116 | 1138 |
" |
1139 |
||
1140 |
"Created: / 12-05-2004 / 11:09:22 / cg" |
|
1141 |
"Modified: / 12-05-2004 / 11:16:53 / cg" |
|
1142 |
! |
|
1143 |
||
1144 |
defaultCommandTemplateToPrintMimeType:mimeType |
|
1145 |
|cmd| |
|
1146 |
||
1147 |
cmd := self defaultPrintCommandPerMIME at:mimeType ifAbsent:nil. |
|
1148 |
cmd isNil ifTrue:[ |
|
1149 |
OperatingSystem isMSWINDOWSlike ifTrue:[ |
|
1150 |
cmd := Win32OperatingSystem::RegistryEntry commandTemplateToPrintMimeType:mimeType |
|
1151 |
]. |
|
1152 |
]. |
|
1153 |
^ cmd |
|
1154 |
||
1155 |
" |
|
1156 |
MIMETypes defaultCommandTemplateToPrintMimeType:'application/pdf' |
|
1157 |
" |
|
2117 | 1158 |
! |
1159 |
||
1160 |
defaultPrintCommandPerMIME |
|
1161 |
"returns the collection which is used to map MIME-type to printing command-templates." |
|
1162 |
||
1163 |
"TODO: move this to OS/UserPreferences" |
|
1164 |
||
1165 |
DefaultPrintCommandPerMIMEPerOS isNil ifTrue:[ |
|
1166 |
self initializeDefaultCommands |
|
1167 |
]. |
|
1168 |
OperatingSystem isUNIXlike ifTrue:[ |
|
1169 |
^ DefaultPrintCommandPerMIMEPerOS at:#unix |
|
1170 |
]. |
|
1171 |
^ DefaultPrintCommandPerMIMEPerOS at:#win32 |
|
2116 | 1172 |
! ! |
1173 |
||
1729 | 1174 |
!MIMETypes class methodsFor:'queries-image formats'! |
1175 |
||
1176 |
imageReaderClasses |
|
1177 |
"return a collection of registered image reader classes" |
|
1178 |
||
1179 |
|setOfClasses| |
|
1180 |
||
1181 |
setOfClasses := IdentitySet new. |
|
1182 |
FileSuffixToImageReaderClassMapping notNil ifTrue:[ |
|
1183 |
FileSuffixToImageReaderClassMapping keysAndValuesDo:[:suff :cls | |
|
1184 |
setOfClasses add:cls |
|
1185 |
]. |
|
1186 |
]. |
|
1187 |
TypeToImageReaderClassMapping notNil ifTrue:[ |
|
1188 |
TypeToImageReaderClassMapping keysAndValuesDo:[:suff :cls | |
|
1189 |
setOfClasses add:cls |
|
1190 |
]. |
|
1191 |
]. |
|
1192 |
^ setOfClasses |
|
1193 |
||
1194 |
"Created: / 30.6.1997 / 22:03:42 / cg" |
|
1195 |
"Modified: / 1.8.1998 / 16:59:52 / cg" |
|
1196 |
! |
|
1197 |
||
1198 |
imageReaderForSuffix:aSuffix |
|
1199 |
"given a file suffix, return an approriate image reader class" |
|
1200 |
||
2724
8e834e62dbbc
Initialize when querying for image type and not yet initialized
Stefan Vogel <sv@exept.de>
parents:
2710
diff
changeset
|
1201 |
FileSuffixToImageReaderClassMapping isNil ifTrue:[ |
8e834e62dbbc
Initialize when querying for image type and not yet initialized
Stefan Vogel <sv@exept.de>
parents:
2710
diff
changeset
|
1202 |
self initializeImageReaderMappings |
8e834e62dbbc
Initialize when querying for image type and not yet initialized
Stefan Vogel <sv@exept.de>
parents:
2710
diff
changeset
|
1203 |
]. |
1729 | 1204 |
^ FileSuffixToImageReaderClassMapping at:aSuffix asLowercase ifAbsent:nil |
1205 |
||
1206 |
"Created: / 30.6.1997 / 21:59:11 / cg" |
|
1207 |
"Modified: / 1.8.1998 / 17:01:58 / cg" |
|
1208 |
! |
|
1209 |
||
1210 |
imageReaderForSuffix:aSuffix put:aReaderClass |
|
1211 |
"register an image reader for a file suffix" |
|
1212 |
||
1213 |
FileSuffixToImageReaderClassMapping isNil ifTrue:[ |
|
2724
8e834e62dbbc
Initialize when querying for image type and not yet initialized
Stefan Vogel <sv@exept.de>
parents:
2710
diff
changeset
|
1214 |
self initializeImageReaderMappings |
1729 | 1215 |
]. |
1216 |
FileSuffixToImageReaderClassMapping at:aSuffix asLowercase put:aReaderClass |
|
1217 |
||
1218 |
"Created: / 30.6.1997 / 21:59:43 / cg" |
|
1219 |
"Modified: / 1.8.1998 / 17:02:14 / cg" |
|
1220 |
! |
|
1221 |
||
1222 |
imageReaderForType:mimeTypeString |
|
1223 |
"given a mime-type, return an approriate image reader class" |
|
1224 |
||
2724
8e834e62dbbc
Initialize when querying for image type and not yet initialized
Stefan Vogel <sv@exept.de>
parents:
2710
diff
changeset
|
1225 |
TypeToImageReaderClassMapping isNil ifTrue:[ |
8e834e62dbbc
Initialize when querying for image type and not yet initialized
Stefan Vogel <sv@exept.de>
parents:
2710
diff
changeset
|
1226 |
self initializeImageReaderMappings |
8e834e62dbbc
Initialize when querying for image type and not yet initialized
Stefan Vogel <sv@exept.de>
parents:
2710
diff
changeset
|
1227 |
]. |
1729 | 1228 |
^ TypeToImageReaderClassMapping at:mimeTypeString asLowercase ifAbsent:nil |
1229 |
||
1230 |
"Created: / 30.6.1997 / 21:56:01 / cg" |
|
1231 |
"Modified: / 1.8.1998 / 17:02:28 / cg" |
|
1232 |
! |
|
1233 |
||
1234 |
imageReaderForType:mimeTypeString put:aReaderClass |
|
1235 |
"register an image reader for a mime-type" |
|
1236 |
||
1237 |
TypeToImageReaderClassMapping isNil ifTrue:[ |
|
2724
8e834e62dbbc
Initialize when querying for image type and not yet initialized
Stefan Vogel <sv@exept.de>
parents:
2710
diff
changeset
|
1238 |
self initializeImageReaderMappings |
1729 | 1239 |
]. |
1240 |
TypeToImageReaderClassMapping at:mimeTypeString asLowercase put:aReaderClass |
|
1241 |
||
1242 |
"Created: / 30.6.1997 / 21:56:11 / cg" |
|
1243 |
"Modified: / 1.8.1998 / 17:02:40 / cg" |
|
1244 |
! ! |
|
1245 |
||
1246 |
!MIMETypes class methodsFor:'queries-language syntax'! |
|
1247 |
||
1248 |
commentStringsForFilename:aFilename |
|
1249 |
"return a useful comment definition; heuristics for now. |
|
1250 |
The returned value is an array of 2 elements; |
|
1251 |
the first is the end-of-line comment string (or nil); |
|
1252 |
the second an array of opening/closing delimiters (or an array of nils)" |
|
1253 |
||
1254 |
|mime| |
|
1255 |
||
1256 |
mime := MIMETypes mimeTypeForFilename:aFilename. |
|
1257 |
^ self commentStringsForMimeType:mime suffix:(aFilename asFilename suffix) |
|
1258 |
||
1259 |
" |
|
1260 |
MIMETypes commentStringsForFilename:'Makefile'. |
|
1261 |
MIMETypes commentStringsForFilename:'Object.st'. |
|
1262 |
MIMETypes commentStringsForFilename:'Foo.java'. |
|
1925 | 1263 |
MIMETypes commentStringsForFilename:'Foo.html'. |
1729 | 1264 |
" |
1265 |
! |
|
1266 |
||
1267 |
commentStringsForFilename:aFilename ifUnknown:alternativeBlockReturningCommentString |
|
1268 |
"return a useful comment definition; heuristics for now. |
|
1269 |
The returned value is an array of 2 elements; |
|
1270 |
the first is the end-of-line comment string (or nil); |
|
1271 |
the second an array of opening/closing delimiters (or an array of nils)" |
|
1272 |
||
1273 |
|mime| |
|
1274 |
||
1275 |
mime := MIMETypes mimeTypeForFilename:aFilename. |
|
1276 |
^ self commentStringsForMimeType:mime suffix:(aFilename asFilename suffix) ifUnknown:alternativeBlockReturningCommentString |
|
1277 |
||
1278 |
" |
|
1279 |
MIMETypes commentStringsForFilename:'Makefile'. |
|
1280 |
MIMETypes commentStringsForFilename:'Object.st'. |
|
1281 |
MIMETypes commentStringsForFilename:'Foo.java'. |
|
1282 |
" |
|
1283 |
! |
|
1284 |
||
1285 |
commentStringsForMimeType:mime suffix:suff |
|
1286 |
"return a useful comment definition; heuristics for now. |
|
1287 |
The returned value is an array of 2 elements; |
|
1288 |
the first is the end-of-line comment string (or nil); |
|
1289 |
the second an array of opening/closing delimiters (or an array of nils)" |
|
1290 |
||
1291 |
^ self |
|
1292 |
commentStringsForMimeType:mime suffix:suff |
|
1293 |
ifUnknown: #(';' (nil nil)) |
|
1294 |
||
1295 |
" |
|
1296 |
|mime| |
|
1297 |
||
1298 |
mime := MIMETypes mimeTypeForFilename:'Makefile'. |
|
1299 |
MIMETypes commentStringsForMimeType:mime suffix:nil. |
|
1300 |
" |
|
1301 |
||
1302 |
" |
|
1303 |
|mime| |
|
1304 |
||
1305 |
mime := MIMETypes mimeTypeForFilename:'Object.st'. |
|
1306 |
MIMETypes commentStringsForMimeType:mime suffix:nil. |
|
1307 |
" |
|
1308 |
! |
|
1309 |
||
1310 |
commentStringsForMimeType:mime suffix:suff ifUnknown:alternativeBlockReturningCommentString |
|
1311 |
"return a useful comment definition; heuristics for now. |
|
1312 |
The returned value is an array of 2 elements; |
|
1313 |
the first is the end-of-line comment string (or nil); |
|
1314 |
the second an array of opening/closing delimiters (or an array of nils)" |
|
1315 |
||
1316 |
|commentSpec| |
|
1317 |
||
1318 |
commentSpec := TypeToCommentStringMapping at:mime ifAbsent:nil. |
|
1319 |
commentSpec notNil ifTrue:[ |
|
1320 |
^ commentSpec |
|
1321 |
]. |
|
1322 |
||
1323 |
commentSpec := SuffixToCommentStringMapping at:suff ifAbsent:nil. |
|
1324 |
commentSpec notNil ifTrue:[ |
|
1325 |
^ commentSpec |
|
1326 |
]. |
|
1327 |
||
1328 |
^ alternativeBlockReturningCommentString value |
|
1329 |
||
1330 |
" |
|
1331 |
|mime| |
|
1332 |
||
1333 |
mime := MIMETypes mimeTypeForFilename:'Makefile'. |
|
1334 |
MIMETypes commentStringsForMimeType:mime suffix:nil. |
|
1335 |
" |
|
1336 |
||
1337 |
" |
|
1338 |
|mime| |
|
1339 |
||
1340 |
mime := MIMETypes mimeTypeForFilename:'Object.st'. |
|
1341 |
MIMETypes commentStringsForMimeType:mime suffix:nil. |
|
1342 |
" |
|
2298 | 1343 |
! |
1344 |
||
2491
831417cc1e5b
Change bas spelling: parentesis to good spellinge parenthesis
Stefan Vogel <sv@exept.de>
parents:
2490
diff
changeset
|
1345 |
parenthesisSpecForFilename:aFilename |
2298 | 1346 |
"return a useful parentesis spec; heuristics for now. |
1347 |
The returned value is a dictionary to be used as parentesis spec in an editor" |
|
1348 |
||
1349 |
|mime| |
|
1350 |
||
1351 |
mime := MIMETypes mimeTypeForFilename:aFilename. |
|
2491
831417cc1e5b
Change bas spelling: parentesis to good spellinge parenthesis
Stefan Vogel <sv@exept.de>
parents:
2490
diff
changeset
|
1352 |
^ self parenthesisSpecForMimeType:mime suffix:(aFilename asFilename suffix) |
2298 | 1353 |
|
1354 |
" |
|
2491
831417cc1e5b
Change bas spelling: parentesis to good spellinge parenthesis
Stefan Vogel <sv@exept.de>
parents:
2490
diff
changeset
|
1355 |
MIMETypes parenthesisSpecForFilename:'Object.st'. |
831417cc1e5b
Change bas spelling: parentesis to good spellinge parenthesis
Stefan Vogel <sv@exept.de>
parents:
2490
diff
changeset
|
1356 |
MIMETypes parenthesisSpecForFilename:'Foo.java'. |
831417cc1e5b
Change bas spelling: parentesis to good spellinge parenthesis
Stefan Vogel <sv@exept.de>
parents:
2490
diff
changeset
|
1357 |
MIMETypes parenthesisSpecForFilename:'Foo.html'. |
831417cc1e5b
Change bas spelling: parentesis to good spellinge parenthesis
Stefan Vogel <sv@exept.de>
parents:
2490
diff
changeset
|
1358 |
MIMETypes parenthesisSpecForFilename:'Foo.lsp'. |
2298 | 1359 |
" |
1360 |
||
1361 |
"Created: / 10-04-2007 / 15:18:41 / cg" |
|
1362 |
! |
|
1363 |
||
2491
831417cc1e5b
Change bas spelling: parentesis to good spellinge parenthesis
Stefan Vogel <sv@exept.de>
parents:
2490
diff
changeset
|
1364 |
parenthesisSpecForFilename:aFilename ifUnknown:alternative |
2298 | 1365 |
|mime| |
1366 |
||
1367 |
mime := MIMETypes mimeTypeForFilename:aFilename. |
|
2491
831417cc1e5b
Change bas spelling: parentesis to good spellinge parenthesis
Stefan Vogel <sv@exept.de>
parents:
2490
diff
changeset
|
1368 |
^ self parenthesisSpecForMimeType:mime suffix:(aFilename asFilename suffix) ifUnknown:alternative |
2298 | 1369 |
|
1370 |
"Created: / 10-04-2007 / 15:26:20 / cg" |
|
1371 |
! |
|
1372 |
||
2491
831417cc1e5b
Change bas spelling: parentesis to good spellinge parenthesis
Stefan Vogel <sv@exept.de>
parents:
2490
diff
changeset
|
1373 |
parenthesisSpecForMimeType:mime suffix:suff |
2298 | 1374 |
^ self |
2491
831417cc1e5b
Change bas spelling: parentesis to good spellinge parenthesis
Stefan Vogel <sv@exept.de>
parents:
2490
diff
changeset
|
1375 |
parenthesisSpecForMimeType:mime suffix:suff |
2298 | 1376 |
ifUnknown: nil |
1377 |
||
1378 |
"Created: / 10-04-2007 / 15:19:39 / cg" |
|
1379 |
! |
|
1380 |
||
2491
831417cc1e5b
Change bas spelling: parentesis to good spellinge parenthesis
Stefan Vogel <sv@exept.de>
parents:
2490
diff
changeset
|
1381 |
parenthesisSpecForMimeType:mime suffix:suff ifUnknown:alternativeValue |
2298 | 1382 |
|spec| |
1383 |
||
2491
831417cc1e5b
Change bas spelling: parentesis to good spellinge parenthesis
Stefan Vogel <sv@exept.de>
parents:
2490
diff
changeset
|
1384 |
spec := TypeToParenthesisSpecMapping at:mime ifAbsent:nil. |
2298 | 1385 |
spec notNil ifTrue:[ |
1386 |
^ spec |
|
1387 |
]. |
|
1388 |
||
2491
831417cc1e5b
Change bas spelling: parentesis to good spellinge parenthesis
Stefan Vogel <sv@exept.de>
parents:
2490
diff
changeset
|
1389 |
spec := SuffixToParenthesisSpecMapping at:suff ifAbsent:nil. |
2298 | 1390 |
spec notNil ifTrue:[ |
1391 |
^ spec |
|
1392 |
]. |
|
1393 |
||
1394 |
^ alternativeValue value |
|
1395 |
||
1396 |
"Created: / 10-04-2007 / 15:20:38 / cg" |
|
1729 | 1397 |
! ! |
1398 |
||
1612 | 1399 |
!MIMETypes::MIMEType class methodsFor:'documentation'! |
1400 |
||
1401 |
documentation |
|
1402 |
" |
|
1864 | 1403 |
like a string, but knows that it represents a mimeType. |
3359 | 1404 |
mimetypes are singletons, remembered in the class variable CachedTypes. |
1612 | 1405 |
" |
1406 |
! ! |
|
1407 |
||
1408 |
!MIMETypes::MIMEType class methodsFor:'instance creation'! |
|
1409 |
||
1410 |
fromString:aString |
|
1411 |
|cachedType newType| |
|
1412 |
||
1413 |
aString class == self ifTrue:[^ aString]. |
|
1414 |
||
3011
f2af94d78383
delay initialization of cachedTypes
Claus Gittinger <cg@exept.de>
parents:
3008
diff
changeset
|
1415 |
CachedTypes isNil ifTrue:[ |
3012 | 1416 |
CachedTypes := Dictionary new:100. |
3011
f2af94d78383
delay initialization of cachedTypes
Claus Gittinger <cg@exept.de>
parents:
3008
diff
changeset
|
1417 |
]. |
1612 | 1418 |
cachedType := CachedTypes at:aString ifAbsent:nil. |
1419 |
cachedType notNil ifTrue:[^ cachedType]. |
|
3011
f2af94d78383
delay initialization of cachedTypes
Claus Gittinger <cg@exept.de>
parents:
3008
diff
changeset
|
1420 |
|
1612 | 1421 |
newType := aString copy changeClassTo:self. |
1422 |
CachedTypes at:aString put:newType. |
|
1423 |
^ newType |
|
1424 |
||
1425 |
" |
|
1426 |
self fromString:'text/html' |
|
1427 |
" |
|
3011
f2af94d78383
delay initialization of cachedTypes
Claus Gittinger <cg@exept.de>
parents:
3008
diff
changeset
|
1428 |
|
3012 | 1429 |
"Modified: / 20-07-2012 / 17:36:31 / cg" |
1612 | 1430 |
! ! |
1431 |
||
1432 |
!MIMETypes::MIMEType methodsFor:'queries'! |
|
1433 |
||
3359 | 1434 |
fileTypeInfo |
1435 |
^ MIMETypes fileTypeInfoForMimeType:self |
|
1436 |
||
1437 |
" |
|
1438 |
(MIMETypes mimeTypeFromString:'application/x-smalltalk-source') fileTypeInfo |
|
1439 |
" |
|
1440 |
! |
|
1441 |
||
1693 | 1442 |
isArchive |
3260 | 1443 |
<resource: #obsolete> |
1444 |
"return true, if I represent an archive type (such as zip or tar)" |
|
1445 |
||
1446 |
^ self isArchiveType |
|
1447 |
! |
|
1448 |
||
1449 |
isArchiveType |
|
1864 | 1450 |
"return true, if I represent an archive type (such as zip or tar)" |
1451 |
||
1612 | 1452 |
|archivTypes| |
1453 |
||
1729 | 1454 |
archivTypes := MIMETypes applicationCompressorsAndArchiveTypeList. |
1612 | 1455 |
archivTypes pairWiseDo:[: ext : type | |
1456 |
self = type ifTrue:[ ^ true]. |
|
1457 |
]. |
|
1458 |
^ false |
|
1459 |
! |
|
1460 |
||
2024 | 1461 |
isBinary |
3260 | 1462 |
<resource: #obsolete> |
1463 |
"return true, if I represent a binary (non-text) type" |
|
1464 |
||
1465 |
^ self isBinaryType |
|
1466 |
! |
|
1467 |
||
1468 |
isBinaryType |
|
2024 | 1469 |
"return true, if I represent a binary (non-text) type" |
1470 |
||
1471 |
^ self isTextType not |
|
1472 |
! |
|
1473 |
||
1612 | 1474 |
isHtml |
3260 | 1475 |
<resource: #obsolete> |
1476 |
"return true, if I represent the html text type" |
|
1477 |
||
1478 |
^ self isHtmlType |
|
1479 |
! |
|
1480 |
||
1481 |
isHtmlType |
|
1864 | 1482 |
"return true, if I represent the html text type" |
1612 | 1483 |
|
1484 |
^ (self = 'text/html') |
|
1485 |
! |
|
1486 |
||
1487 |
isImage |
|
3260 | 1488 |
<resource: #obsolete> |
1489 |
"return true, if I represent an image type (such as gif or jpg)" |
|
1490 |
||
1491 |
^ self isImageType |
|
1492 |
! |
|
1493 |
||
1494 |
isImageType |
|
1864 | 1495 |
"return true, if I represent an image type (such as gif or jpg)" |
1612 | 1496 |
|
1693 | 1497 |
^ (self startsWith:'image/') |
1612 | 1498 |
! |
1499 |
||
1500 |
isPdf |
|
3260 | 1501 |
<resource: #obsolete> |
1502 |
"return true, if I represent the pdf type" |
|
1503 |
||
1504 |
^ self isPdfType |
|
1505 |
! |
|
1506 |
||
1507 |
isPdfType |
|
1864 | 1508 |
"return true, if I represent the pdf type" |
1509 |
||
1612 | 1510 |
^ (self = 'application/pdf') |
1511 |
! |
|
1512 |
||
1513 |
isSmalltalkSource |
|
3260 | 1514 |
<resource: #obsolete> |
1515 |
"return true, if I represent the smalltalk sourcecode type" |
|
1516 |
||
1517 |
^ self isSmalltalkSourceType |
|
1518 |
! |
|
1519 |
||
1520 |
isSmalltalkSourceType |
|
1864 | 1521 |
"return true, if I represent the smalltalk sourcecode type" |
1522 |
||
3359 | 1523 |
^ (self startsWith: 'application/x-smalltalk-source') |
1783 | 1524 |
! |
1525 |
||
2024 | 1526 |
isTextType |
1527 |
"return true, if I represent some text type" |
|
1528 |
||
1529 |
^ self startsWith:'text/' |
|
1530 |
! |
|
1531 |
||
1783 | 1532 |
isXml |
3260 | 1533 |
<resource: #obsolete> |
1534 |
"return true, if I represent the xml text type" |
|
1535 |
||
1536 |
^ self isXmlType |
|
1537 |
! |
|
1538 |
||
1539 |
isXmlType |
|
1864 | 1540 |
"return true, if I represent the xml text type" |
1541 |
||
1783 | 1542 |
^ (self = 'text/xml') |
2490 | 1543 |
! |
1544 |
||
1545 |
suffix |
|
1546 |
^ MIMETypes suffixForMimeType:self |
|
1547 |
||
1548 |
" |
|
1549 |
(MIMETypes mimeTypeFromString:'application/x-expecco-testsuite') suffix |
|
1550 |
" |
|
643 | 1551 |
! ! |
1552 |
||
1553 |
!MIMETypes class methodsFor:'documentation'! |
|
1554 |
||
1555 |
version |
|
3380 | 1556 |
^ '$Header: /cvs/stx/stx/libview2/MIMETypes.st,v 1.137 2014-11-09 22:17:21 cg Exp $' |
2758
66e62ceecb67
comment/format in: #defaultCommandForMimeType:
Claus Gittinger <cg@exept.de>
parents:
2724
diff
changeset
|
1557 |
! |
66e62ceecb67
comment/format in: #defaultCommandForMimeType:
Claus Gittinger <cg@exept.de>
parents:
2724
diff
changeset
|
1558 |
|
66e62ceecb67
comment/format in: #defaultCommandForMimeType:
Claus Gittinger <cg@exept.de>
parents:
2724
diff
changeset
|
1559 |
version_CVS |
3380 | 1560 |
^ '$Header: /cvs/stx/stx/libview2/MIMETypes.st,v 1.137 2014-11-09 22:17:21 cg Exp $' |
643 | 1561 |
! ! |
1666 | 1562 |
|
3104 | 1563 |
|
643 | 1564 |
MIMETypes initialize! |