author | Claus Gittinger <cg@exept.de> |
Tue, 16 Sep 2014 16:56:08 +0200 | |
changeset 3367 | 048fc9f61885 |
parent 3359 | 62084f197409 |
child 3380 | e7a59408d31a |
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. |
1729 | 362 |
|
363 |
"/ setup suffix to image reader class mapping ... |
|
364 |
FileSuffixToImageReaderClassMapping at:'jpg' put:JPEGReader. |
|
3295 | 365 |
FileSuffixToImageReaderClassMapping at:'jpeg' put:JPEGReader. |
1729 | 366 |
FileSuffixToImageReaderClassMapping at:'gif' put:GIFReader. |
367 |
FileSuffixToImageReaderClassMapping at:'tif' put:TIFFReader. |
|
3295 | 368 |
FileSuffixToImageReaderClassMapping at:'tiff' put:TIFFReader. |
2710 | 369 |
FileSuffixToImageReaderClassMapping at:'png' put:PNGReader. |
2570 | 370 |
|
3295 | 371 |
"/ some 'used-to-be-optional' readers |
372 |
(rdr := Smalltalk at:#WindowsIconReader) notNil ifTrue:[ |
|
373 |
TypeToImageReaderClassMapping at:'image/bmp' put:rdr. |
|
374 |
TypeToImageReaderClassMapping at:'image/x-MS-bmp' put:rdr. |
|
375 |
TypeToImageReaderClassMapping at:'image/x-MS-ico' put:rdr. |
|
376 |
FileSuffixToImageReaderClassMapping at:'bmp' put:rdr. |
|
377 |
FileSuffixToImageReaderClassMapping at:'ico' put:rdr. |
|
378 |
]. |
|
379 |
(rdr := Smalltalk at:#XBMReader) notNil ifTrue:[ |
|
380 |
TypeToImageReaderClassMapping at:'image/x-xbitmap' put:rdr. |
|
381 |
FileSuffixToImageReaderClassMapping at:'xbm' put:rdr. |
|
382 |
]. |
|
383 |
(rdr := Smalltalk at:#XPMReader) notNil ifTrue:[ |
|
384 |
TypeToImageReaderClassMapping at:'image/x-xpixmap' put:rdr. |
|
385 |
FileSuffixToImageReaderClassMapping at:'pm' put:rdr. |
|
386 |
]. |
|
387 |
(rdr := Smalltalk at:#PBMReader) notNil ifTrue:[ |
|
388 |
TypeToImageReaderClassMapping at:'image/x-portable-pixmap' put:rdr. |
|
389 |
TypeToImageReaderClassMapping at:'image/x-portable-bitmap' put:rdr. |
|
390 |
TypeToImageReaderClassMapping at:'image/x-portable-graymap' put:rdr. |
|
391 |
TypeToImageReaderClassMapping at:'image/x-portable-anymap' put:rdr. |
|
392 |
FileSuffixToImageReaderClassMapping at:'ppm' put:rdr. |
|
393 |
FileSuffixToImageReaderClassMapping at:'pbm' put:rdr. |
|
394 |
FileSuffixToImageReaderClassMapping at:'pgm' put:rdr. |
|
395 |
FileSuffixToImageReaderClassMapping at:'pnm' put:rdr. |
|
396 |
]. |
|
397 |
(rdr := Smalltalk at:#PCXReader) notNil ifTrue:[ |
|
398 |
TypeToImageReaderClassMapping at:'image/x-pcx' put:rdr. |
|
399 |
FileSuffixToImageReaderClassMapping at:'pcx' put:rdr. |
|
400 |
]. |
|
401 |
(rdr := Smalltalk at:#TargaReader) notNil ifTrue:[ |
|
402 |
TypeToImageReaderClassMapping at:'image/x-targa' put:rdr. |
|
403 |
FileSuffixToImageReaderClassMapping at:'tga' put:rdr. |
|
404 |
]. |
|
405 |
(rdr := Smalltalk at:#XWDReader) notNil ifTrue:[ |
|
406 |
TypeToImageReaderClassMapping at:'image/x-xwindowdump' put:rdr. |
|
407 |
TypeToImageReaderClassMapping at:'image/x-windowdump' put:rdr. |
|
408 |
FileSuffixToImageReaderClassMapping at:'xwd' put:rdr. |
|
409 |
]. |
|
410 |
(rdr := Smalltalk at:#BlitImageReader) notNil ifTrue:[ |
|
411 |
TypeToImageReaderClassMapping at:'image/x-blitimage' put:rdr. |
|
412 |
FileSuffixToImageReaderClassMapping at:'48x48x1' put:rdr. |
|
413 |
]. |
|
414 |
(rdr := Smalltalk at:#IrisRGBReader) notNil ifTrue:[ |
|
415 |
TypeToImageReaderClassMapping at:'image/x-rgb' put:rdr. |
|
416 |
FileSuffixToImageReaderClassMapping at:'rgb' put:rdr. |
|
417 |
]. |
|
418 |
(rdr := Smalltalk at:#SunRasterReader) notNil ifTrue:[ |
|
419 |
TypeToImageReaderClassMapping at:'image/x-sunraster' put:rdr. |
|
420 |
FileSuffixToImageReaderClassMapping at:'im8' put:rdr. |
|
421 |
FileSuffixToImageReaderClassMapping at:'icon' put:rdr. |
|
2570 | 422 |
]. |
3295 | 423 |
(rdr := Smalltalk at:#ST80FormReader) notNil ifTrue:[ |
424 |
TypeToImageReaderClassMapping at:'image/x-st80-form' put:rdr. |
|
425 |
FileSuffixToImageReaderClassMapping at:'form' put:rdr. |
|
426 |
]. |
|
427 |
(rdr := Smalltalk at:#FaceReader) notNil ifTrue:[ |
|
428 |
TypeToImageReaderClassMapping at:'image/x-face' put:rdr. |
|
429 |
FileSuffixToImageReaderClassMapping at:'face' put:rdr. |
|
430 |
]. |
|
431 |
(rdr := Smalltalk at:#PCDReader) notNil ifTrue:[ |
|
432 |
TypeToImageReaderClassMapping at:'image/x-photo-cd' put:rdr. |
|
433 |
FileSuffixToImageReaderClassMapping at:'pcd' put:rdr. |
|
434 |
]. |
|
435 |
(rdr := Smalltalk at:#CMURasterReader) notNil ifTrue:[ |
|
436 |
TypeToImageReaderClassMapping at:'image/x-cmu-raster' put:rdr. |
|
437 |
FileSuffixToImageReaderClassMapping at:'ras' put:rdr. |
|
438 |
]. |
|
439 |
||
3359 | 440 |
"/ movie formats - experimental and not yet complete / finished / delivered / published |
3295 | 441 |
"/ (rdr := Smalltalk at:#FLIReader) notNil ifTrue:[ |
442 |
"/ TypeToImageReaderClassMapping at:'video/x-fli' put:rdr. |
|
443 |
"/ FileSuffixToImageReaderClassMapping at:'fli' put:rdr. |
|
444 |
"/ ]. |
|
445 |
"/ (rdr := Smalltalk at:#AVIReader) notNil ifTrue:[ |
|
446 |
"/ TypeToImageReaderClassMapping at:'video/x-msvideo' put:rdr. |
|
447 |
"/ FileSuffixToImageReaderClassMapping at:'avi' put:rdr. |
|
448 |
"/ ]. |
|
449 |
"/ (rdr := Smalltalk at:#AVIReader) notNil ifTrue:[ |
|
450 |
"/ TypeToImageReaderClassMapping at:'video/x-msvideo' put:rdr. |
|
451 |
"/ FileSuffixToImageReaderClassMapping at:'avi' put:rdr. |
|
452 |
"/ ]. |
|
453 |
"/ (rdr := Smalltalk at:#QuickTimeReader) notNil ifTrue:[ |
|
454 |
"/ TypeToImageReaderClassMapping at:'video/quicktime' put:rdr. |
|
455 |
"/ FileSuffixToImageReaderClassMapping at:'qt' put:rdr. |
|
456 |
"/ FileSuffixToImageReaderClassMapping at:'mov' put:rdr. |
|
457 |
"/ FileSuffixToImageReaderClassMapping at:'moov' put:rdr. |
|
458 |
"/ ]. |
|
459 |
"/ (rdr := Smalltalk at:#MPEG2Reader) notNil ifTrue:[ |
|
460 |
"/ TypeToImageReaderClassMapping at:'video/x-mpeg2' put:rdr. |
|
461 |
"/ FileSuffixToImageReaderClassMapping at:'mpg2' put:rdr. |
|
462 |
"/ FileSuffixToImageReaderClassMapping at:'mpv2' put:rdr. |
|
463 |
"/ FileSuffixToImageReaderClassMapping at:'mp2v' put:rdr. |
|
464 |
"/ FileSuffixToImageReaderClassMapping at:'mp2' put:rdr. |
|
465 |
"/ ]. |
|
466 |
"/ (rdr := Smalltalk at:#MPEGReader) notNil ifTrue:[ |
|
467 |
"/ TypeToImageReaderClassMapping at:'video/mpeg' put:rdr. |
|
468 |
"/ FileSuffixToImageReaderClassMapping at:'mpg' put:rdr. |
|
469 |
"/ FileSuffixToImageReaderClassMapping at:'mpeg' put:rdr. |
|
470 |
"/ FileSuffixToImageReaderClassMapping at:'mpe' put:rdr. |
|
471 |
"/ FileSuffixToImageReaderClassMapping at:'mpv' put:rdr. |
|
472 |
"/ FileSuffixToImageReaderClassMapping at:'vps' put:rdr. |
|
473 |
"/ FileSuffixToImageReaderClassMapping at:'mpegv' put:rdr. |
|
474 |
"/ ]. |
|
475 |
"/ (rdr := Smalltalk at:#SGIMovieReader) notNil ifTrue:[ |
|
476 |
"/ TypeToImageReaderClassMapping at:'video/x-sgi-movie' put:rdr. |
|
477 |
"/ FileSuffixToImageReaderClassMapping at:'movie' put:rdr. |
|
478 |
"/ ]. |
|
2298 | 479 |
! |
480 |
||
2491
831417cc1e5b
Change bas spelling: parentesis to good spellinge parenthesis
Stefan Vogel <sv@exept.de>
parents:
2490
diff
changeset
|
481 |
initializeParenthesisSpecMappings |
3359 | 482 |
"these are used by the editors to mark matching parenthesis" |
483 |
||
2298 | 484 |
|spec| |
485 |
||
2491
831417cc1e5b
Change bas spelling: parentesis to good spellinge parenthesis
Stefan Vogel <sv@exept.de>
parents:
2490
diff
changeset
|
486 |
TypeToParenthesisSpecMapping := Dictionary new. |
831417cc1e5b
Change bas spelling: parentesis to good spellinge parenthesis
Stefan Vogel <sv@exept.de>
parents:
2490
diff
changeset
|
487 |
SuffixToParenthesisSpecMapping := Dictionary new. |
831417cc1e5b
Change bas spelling: parentesis to good spellinge parenthesis
Stefan Vogel <sv@exept.de>
parents:
2490
diff
changeset
|
488 |
|
2298 | 489 |
"/ ST/X spec |
2491
831417cc1e5b
Change bas spelling: parentesis to good spellinge parenthesis
Stefan Vogel <sv@exept.de>
parents:
2490
diff
changeset
|
490 |
spec := IdentityDictionary new. |
831417cc1e5b
Change bas spelling: parentesis to good spellinge parenthesis
Stefan Vogel <sv@exept.de>
parents:
2490
diff
changeset
|
491 |
spec at:#open put:#( $( $[ ${ ). |
831417cc1e5b
Change bas spelling: parentesis to good spellinge parenthesis
Stefan Vogel <sv@exept.de>
parents:
2490
diff
changeset
|
492 |
spec at:#close put:#( $) $] $} ). |
831417cc1e5b
Change bas spelling: parentesis to good spellinge parenthesis
Stefan Vogel <sv@exept.de>
parents:
2490
diff
changeset
|
493 |
spec at:#ignore put:#( $' $" '$[' '$]' '${' '$)' ). |
831417cc1e5b
Change bas spelling: parentesis to good spellinge parenthesis
Stefan Vogel <sv@exept.de>
parents:
2490
diff
changeset
|
494 |
spec at:#eolComment put:'"/'. |
831417cc1e5b
Change bas spelling: parentesis to good spellinge parenthesis
Stefan Vogel <sv@exept.de>
parents:
2490
diff
changeset
|
495 |
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
|
496 |
|
2479 | 497 |
"/ XML & HTML |
2491
831417cc1e5b
Change bas spelling: parentesis to good spellinge parenthesis
Stefan Vogel <sv@exept.de>
parents:
2490
diff
changeset
|
498 |
spec := IdentityDictionary new. |
831417cc1e5b
Change bas spelling: parentesis to good spellinge parenthesis
Stefan Vogel <sv@exept.de>
parents:
2490
diff
changeset
|
499 |
spec at:#open put:#( $< ). |
831417cc1e5b
Change bas spelling: parentesis to good spellinge parenthesis
Stefan Vogel <sv@exept.de>
parents:
2490
diff
changeset
|
500 |
spec at:#close put:#( $> ). |
831417cc1e5b
Change bas spelling: parentesis to good spellinge parenthesis
Stefan Vogel <sv@exept.de>
parents:
2490
diff
changeset
|
501 |
spec at:#ignore put:#( $' $" '$[' '$]' '${' '$)' ). |
831417cc1e5b
Change bas spelling: parentesis to good spellinge parenthesis
Stefan Vogel <sv@exept.de>
parents:
2490
diff
changeset
|
502 |
#( '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
|
503 |
TypeToParenthesisSpecMapping at:eachXMLType put:spec |
2298 | 504 |
]. |
2491
831417cc1e5b
Change bas spelling: parentesis to good spellinge parenthesis
Stefan Vogel <sv@exept.de>
parents:
2490
diff
changeset
|
505 |
|
3359 | 506 |
"/ ANSI-c, Java, C# |
2491
831417cc1e5b
Change bas spelling: parentesis to good spellinge parenthesis
Stefan Vogel <sv@exept.de>
parents:
2490
diff
changeset
|
507 |
spec := IdentityDictionary new. |
831417cc1e5b
Change bas spelling: parentesis to good spellinge parenthesis
Stefan Vogel <sv@exept.de>
parents:
2490
diff
changeset
|
508 |
spec at:#open put:#( $( $[ ${ ). |
831417cc1e5b
Change bas spelling: parentesis to good spellinge parenthesis
Stefan Vogel <sv@exept.de>
parents:
2490
diff
changeset
|
509 |
spec at:#close put:#( $) $] $} ). |
831417cc1e5b
Change bas spelling: parentesis to good spellinge parenthesis
Stefan Vogel <sv@exept.de>
parents:
2490
diff
changeset
|
510 |
spec at:#ignore put:#( $' $" ). |
831417cc1e5b
Change bas spelling: parentesis to good spellinge parenthesis
Stefan Vogel <sv@exept.de>
parents:
2490
diff
changeset
|
511 |
spec at:#eolComment put:'//'. |
831417cc1e5b
Change bas spelling: parentesis to good spellinge parenthesis
Stefan Vogel <sv@exept.de>
parents:
2490
diff
changeset
|
512 |
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
|
513 |
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
|
514 |
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
|
515 |
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
|
516 |
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
|
517 |
|
3359 | 518 |
"/ Lisp / Scheme |
2491
831417cc1e5b
Change bas spelling: parentesis to good spellinge parenthesis
Stefan Vogel <sv@exept.de>
parents:
2490
diff
changeset
|
519 |
spec := IdentityDictionary new. |
3039 | 520 |
spec at:#open put:#( $( $[ ). |
521 |
spec at:#close put:#( $) $] ). |
|
2491
831417cc1e5b
Change bas spelling: parentesis to good spellinge parenthesis
Stefan Vogel <sv@exept.de>
parents:
2490
diff
changeset
|
522 |
spec at:#ignore put:#( $" ). |
831417cc1e5b
Change bas spelling: parentesis to good spellinge parenthesis
Stefan Vogel <sv@exept.de>
parents:
2490
diff
changeset
|
523 |
spec at:#eolComment put:';'. |
831417cc1e5b
Change bas spelling: parentesis to good spellinge parenthesis
Stefan Vogel <sv@exept.de>
parents:
2490
diff
changeset
|
524 |
TypeToParenthesisSpecMapping at:'application/x-lisp-source' put:spec. |
2298 | 525 |
|
526 |
"Created: / 10-04-2007 / 15:16:37 / cg" |
|
1729 | 527 |
! ! |
528 |
||
529 |
!MIMETypes class methodsFor:'initialization-lists'! |
|
530 |
||
531 |
applicationCompressorsAndArchiveTypeList |
|
1604 | 532 |
^ #( |
1890 | 533 |
'tar' 'application/x-tar' |
534 |
'gtar' 'application/x-gtar' |
|
1891 | 535 |
('tgz' 'tar.gz') 'application/x-tar-gzip-compressed' "/ 'application/x-tar-compressed' |
536 |
('tar.bz2') 'application/x-tar-bzip2-compressed' |
|
1890 | 537 |
'zip' 'application/x-zip-compressed' |
538 |
'bz2' 'application/x-bzip2-compressed' |
|
539 |
('gz' 'z') 'application/x-gzip-compressed' |
|
540 |
'cpio' 'application/x-cpio' |
|
541 |
'shar' 'application/x-shar' |
|
542 |
'jar' 'application/java-archive' |
|
543 |
'sar' 'application/x-squeak-archive' |
|
544 |
'sit' 'application/x-stuffit' |
|
545 |
'hqx' 'application/mac-binhex40' |
|
546 |
'cpt' 'application/mac-compactpro' |
|
1604 | 547 |
) |
548 |
! |
|
645 | 549 |
|
1609 | 550 |
applicationMiscTypeList |
551 |
"misc applications" |
|
552 |
||
553 |
^ #( |
|
554 |
('a' 'o' 'obj' ) 'application/binary' |
|
2968 | 555 |
('lic') 'application/license' |
1609 | 556 |
('dll' 'so') 'application/shared-library' |
2486
42063a7fc3db
mimeType: x-expecco-testSuite (extension: ets)
Claus Gittinger <cg@exept.de>
parents:
2479
diff
changeset
|
557 |
|
42063a7fc3db
mimeType: x-expecco-testSuite (extension: ets)
Claus Gittinger <cg@exept.de>
parents:
2479
diff
changeset
|
558 |
('ets') 'application/x-expecco-testsuite' |
3104 | 559 |
('etr') 'application/x-expecco-testrepository' |
2489
b891d96fd496
elf extension: x-expecco-logfile
Claus Gittinger <cg@exept.de>
parents:
2487
diff
changeset
|
560 |
('elf') 'application/x-expecco-logfile' |
2886
22b48a4da285
comment/format in: #initializeFileNameToMimeTypeMapping
sr
parents:
2830
diff
changeset
|
561 |
('expeccolicense') 'application/x-expecco-license' |
2888 | 562 |
('expeccopatch') 'application/x-expecco-patch' |
1609 | 563 |
) |
2886
22b48a4da285
comment/format in: #initializeFileNameToMimeTypeMapping
sr
parents:
2830
diff
changeset
|
564 |
|
2968 | 565 |
"Modified: / 03-11-2011 / 10:42:28 / sr" |
1609 | 566 |
! |
567 |
||
1604 | 568 |
applicationProgLangTypeList |
3020
3f9c74ff0975
changed: #applicationProgLangTypeList
Claus Gittinger <cg@exept.de>
parents:
3014
diff
changeset
|
569 |
"applications for programming languages" |
713 | 570 |
|
1604 | 571 |
^ #( |
1609 | 572 |
('st' 'cls' 'rc') 'application/x-smalltalk-source' |
1604 | 573 |
'sif' 'application/x-smalltalk-source-sif' |
1668 | 574 |
'pac' 'application/x-smalltalk-dolphin-package' |
1778 | 575 |
|
576 |
'sts' 'application/x-squeak-source' |
|
577 |
'pr' 'application/x-squeak-project' |
|
578 |
||
1604 | 579 |
'c' 'application/x-c-source' |
580 |
('cc' 'cpp') 'application/x-cpp-source' |
|
2479 | 581 |
'cs' 'application/x-csharp-source' |
1609 | 582 |
('h' 'hi') 'application/x-c-header' |
1604 | 583 |
('js' 'mocha') 'application/x-javascript' |
584 |
('java' 'jav') 'application/x-java-source' |
|
585 |
'sh' 'application/x-sh' |
|
586 |
'csh' 'application/x-csh' |
|
587 |
'tcl' 'application/x-tcl' |
|
588 |
'pl' 'application/x-perl' |
|
3020
3f9c74ff0975
changed: #applicationProgLangTypeList
Claus Gittinger <cg@exept.de>
parents:
3014
diff
changeset
|
589 |
'dart' 'application/x-dart' |
1604 | 590 |
'mak' 'application/x-make' |
591 |
'bat' 'application/x-batch-script' |
|
3008 | 592 |
('asn1' 'x409' 'gdmo' 'gdm') 'application/x-asn1-source' |
593 |
||
2912
f3466ea0810b
changed: #applicationProgLangTypeList
Claus Gittinger <cg@exept.de>
parents:
2911
diff
changeset
|
594 |
('lisp' 'lsp' 'scm' 'ss' |
f3466ea0810b
changed: #applicationProgLangTypeList
Claus Gittinger <cg@exept.de>
parents:
2911
diff
changeset
|
595 |
'arc' 'cl' 'brg') 'application/x-lisp-source' |
1604 | 596 |
) |
2298 | 597 |
|
3020
3f9c74ff0975
changed: #applicationProgLangTypeList
Claus Gittinger <cg@exept.de>
parents:
3014
diff
changeset
|
598 |
"Modified (comment): / 21-08-2012 / 20:55:13 / cg" |
1604 | 599 |
! |
1561 | 600 |
|
1604 | 601 |
applicationTextTypeList |
1606 | 602 |
"text applications" |
1604 | 603 |
|
604 |
^ #( |
|
605 |
('ps' 'eps') 'application/postscript' |
|
1778 | 606 |
"/ 'ai' 'application/postscript' |
1604 | 607 |
'pdf' 'application/pdf' |
608 |
'rtf' 'application/rtf' |
|
1778 | 609 |
"/ 'rtf' 'text/rtf' ???? |
3008 | 610 |
'ics' 'text/calendar' |
611 |
'doc' 'application/ms-word-document' |
|
1778 | 612 |
"/ 'doc' 'application/winword' |
613 |
'swf' 'application/x-shockwave-flash' |
|
614 |
('ppt' 'ppz' 'pot' 'pps') 'application/mspowerpoint' |
|
2028 | 615 |
'xls' 'application/x-excel' |
616 |
'slk' 'application/vnd.ms-excel' |
|
2911
7afaf1fdae8b
comment/format in: #mimeTypeForFilename:
Claus Gittinger <cg@exept.de>
parents:
2904
diff
changeset
|
617 |
'txt' 'text/plain' |
2970
8b91ec204044
comment/format in: #initialize
Claus Gittinger <cg@exept.de>
parents:
2968
diff
changeset
|
618 |
'xlsx' 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' |
1604 | 619 |
) |
2911
7afaf1fdae8b
comment/format in: #mimeTypeForFilename:
Claus Gittinger <cg@exept.de>
parents:
2904
diff
changeset
|
620 |
|
3008 | 621 |
"Modified: / 26-05-2012 / 15:27:30 / cg" |
1604 | 622 |
! |
623 |
||
624 |
applicationTypeList |
|
1606 | 625 |
"applications" |
1604 | 626 |
|
1729 | 627 |
|typeList| |
1180
c3309b30d14f
code cleanup & added mimeType aquire fallBack via OS
Claus Gittinger <cg@exept.de>
parents:
1023
diff
changeset
|
628 |
|
1729 | 629 |
typeList := OrderedCollection new. |
630 |
typeList addAll:self applicationProgLangTypeList. |
|
631 |
typeList addAll:self applicationTextTypeList. |
|
632 |
typeList addAll:self applicationCompressorsAndArchiveTypeList. |
|
633 |
typeList addAll:self applicationMiscTypeList. |
|
1616 | 634 |
|
1729 | 635 |
^ typeList |
1604 | 636 |
! |
637 |
||
638 |
audioTypeList |
|
1606 | 639 |
"audio formats ..." |
1180
c3309b30d14f
code cleanup & added mimeType aquire fallBack via OS
Claus Gittinger <cg@exept.de>
parents:
1023
diff
changeset
|
640 |
|
1604 | 641 |
^ #( |
1720 | 642 |
('au' 'snd') 'audio/basic' |
1778 | 643 |
('ra') 'audio/x-realaudio' |
644 |
('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
|
645 |
"/ cg: see unixSpecific / windowsSpecific |
ef0f346b8f43
rpm suffix is RPM-package under unix (realplayer under windows)
Claus Gittinger <cg@exept.de>
parents:
1887
diff
changeset
|
646 |
"/ 'rpm' 'audio/x-pn-realaudio-plugin' |
3008 | 647 |
('mpa' 'mpega' 'mpga') 'audio/mpeg' |
1778 | 648 |
"/ 'mp3' 'audio/x-mp3' |
649 |
('mp3' 'mp2') 'audio/mpeg' |
|
1604 | 650 |
'wav' 'audio/x-wav' |
651 |
('aif' 'aiff' 'aifc') 'audio/x-aiff' |
|
1778 | 652 |
('midi' 'mid') 'audio/midi' |
1604 | 653 |
) |
3008 | 654 |
|
655 |
"Modified: / 26-05-2012 / 15:23:45 / cg" |
|
1604 | 656 |
! |
657 |
||
658 |
imageTypeList |
|
659 |
||
660 |
^ #( |
|
1180
c3309b30d14f
code cleanup & added mimeType aquire fallBack via OS
Claus Gittinger <cg@exept.de>
parents:
1023
diff
changeset
|
661 |
"/ image formats ... |
c3309b30d14f
code cleanup & added mimeType aquire fallBack via OS
Claus Gittinger <cg@exept.de>
parents:
1023
diff
changeset
|
662 |
|
1216 | 663 |
('jpg' 'jpeg') 'image/jpeg' |
1188 | 664 |
'gif' 'image/gif' |
665 |
('tif' 'tiff') 'image/tiff' |
|
3295 | 666 |
('xbm' 'bm') 'image/x-xbitmap' |
1188 | 667 |
'xpm' 'image/x-xpixmap' |
1720 | 668 |
'png' 'image/png' |
1188 | 669 |
'pcd' 'image/x-photo-cd' |
670 |
'bmp' 'image/x-MS-bmp' |
|
671 |
'rgb' 'image/x-rgb' |
|
672 |
'ppm' 'image/x-portable-pixmap' |
|
673 |
'pgm' 'image/x-portable-graymap' |
|
674 |
'pbm' 'image/x-portable-bitmap' |
|
675 |
'pnm' 'image/x-portable-anymap' |
|
676 |
'xwd' 'image/x-xwindowdump' |
|
677 |
'ras' 'image/x-cmu-raster' |
|
1216 | 678 |
'tga' 'image/x-targa' |
2020 | 679 |
'ico' 'image/x-ico' |
1604 | 680 |
) |
681 |
! |
|
1180
c3309b30d14f
code cleanup & added mimeType aquire fallBack via OS
Claus Gittinger <cg@exept.de>
parents:
1023
diff
changeset
|
682 |
|
1609 | 683 |
miscFilenameList |
3104 | 684 |
"other formats (not by suffix, but by fileName instead) ..." |
1609 | 685 |
|
686 |
^ #( |
|
2113 | 687 |
('makefile' 'make.proto' 'make.spec' 'nt.mak') 'application/x-make' |
2830 | 688 |
('exe' 'bin' 'com') 'application/octet-stream' |
2113 | 689 |
('class') 'application/octet-stream' |
2375 | 690 |
('top') 'application/x-waltop-digital-notepad' |
1609 | 691 |
) |
692 |
! |
|
693 |
||
1888
ef0f346b8f43
rpm suffix is RPM-package under unix (realplayer under windows)
Claus Gittinger <cg@exept.de>
parents:
1887
diff
changeset
|
694 |
osSpecificTypeList |
ef0f346b8f43
rpm suffix is RPM-package under unix (realplayer under windows)
Claus Gittinger <cg@exept.de>
parents:
1887
diff
changeset
|
695 |
OperatingSystem isMSWINDOWSlike ifTrue:[ |
ef0f346b8f43
rpm suffix is RPM-package under unix (realplayer under windows)
Claus Gittinger <cg@exept.de>
parents:
1887
diff
changeset
|
696 |
^ self windowsSpecificTypeList |
ef0f346b8f43
rpm suffix is RPM-package under unix (realplayer under windows)
Claus Gittinger <cg@exept.de>
parents:
1887
diff
changeset
|
697 |
]. |
ef0f346b8f43
rpm suffix is RPM-package under unix (realplayer under windows)
Claus Gittinger <cg@exept.de>
parents:
1887
diff
changeset
|
698 |
^ self unixSpecificTypeList |
2023 | 699 |
|
700 |
" |
|
701 |
self osSpecificTypeList |
|
702 |
" |
|
1888
ef0f346b8f43
rpm suffix is RPM-package under unix (realplayer under windows)
Claus Gittinger <cg@exept.de>
parents:
1887
diff
changeset
|
703 |
! |
ef0f346b8f43
rpm suffix is RPM-package under unix (realplayer under windows)
Claus Gittinger <cg@exept.de>
parents:
1887
diff
changeset
|
704 |
|
1604 | 705 |
textTypeList |
706 |
"/ misc text ... |
|
707 |
||
708 |
^ #( |
|
1887 | 709 |
('html' 'htm' 'shtml') 'text/html' |
1604 | 710 |
('txt' 'text') 'text/plain' |
1680 | 711 |
'xml' 'text/xml' |
1777 | 712 |
'css' 'text/css' |
2432 | 713 |
'csv' 'text/csv' |
1604 | 714 |
) |
715 |
! |
|
716 |
||
1888
ef0f346b8f43
rpm suffix is RPM-package under unix (realplayer under windows)
Claus Gittinger <cg@exept.de>
parents:
1887
diff
changeset
|
717 |
unixSpecificTypeList |
ef0f346b8f43
rpm suffix is RPM-package under unix (realplayer under windows)
Claus Gittinger <cg@exept.de>
parents:
1887
diff
changeset
|
718 |
|
ef0f346b8f43
rpm suffix is RPM-package under unix (realplayer under windows)
Claus Gittinger <cg@exept.de>
parents:
1887
diff
changeset
|
719 |
^ #( |
ef0f346b8f43
rpm suffix is RPM-package under unix (realplayer under windows)
Claus Gittinger <cg@exept.de>
parents:
1887
diff
changeset
|
720 |
"/ 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
|
721 |
"/ 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
|
722 |
'rpm' 'application/x-rpm' |
ef0f346b8f43
rpm suffix is RPM-package under unix (realplayer under windows)
Claus Gittinger <cg@exept.de>
parents:
1887
diff
changeset
|
723 |
) |
ef0f346b8f43
rpm suffix is RPM-package under unix (realplayer under windows)
Claus Gittinger <cg@exept.de>
parents:
1887
diff
changeset
|
724 |
! |
ef0f346b8f43
rpm suffix is RPM-package under unix (realplayer under windows)
Claus Gittinger <cg@exept.de>
parents:
1887
diff
changeset
|
725 |
|
1604 | 726 |
videoTypeList |
727 |
"/ video formats ... |
|
728 |
||
729 |
^ #( |
|
1720 | 730 |
('qt' 'mov' 'moov') 'video/quicktime' |
731 |
('mpv' 'mpegv' 'mpg' 'mpeg' 'mpe') 'video/mpeg' |
|
1604 | 732 |
'movie' 'video/x-sgi-movie' |
1820 | 733 |
('avi' 'wmv' 'asf') 'video/x-msvideo' |
1604 | 734 |
('mpv2' 'mp2v' 'mp2' 'mpeg2') 'video/x-mpeg2' |
3367 | 735 |
('mp4') 'video/mp4' |
1680 | 736 |
'rm' 'application/vnd.rn-realmedia' |
737 |
'rv' 'video/x-pn-realvideo' |
|
3295 | 738 |
'fli' 'video/x-fli' |
3367 | 739 |
'flv' 'video/x-flv' "/ macromedia flash video |
1778 | 740 |
) |
1888
ef0f346b8f43
rpm suffix is RPM-package under unix (realplayer under windows)
Claus Gittinger <cg@exept.de>
parents:
1887
diff
changeset
|
741 |
! |
ef0f346b8f43
rpm suffix is RPM-package under unix (realplayer under windows)
Claus Gittinger <cg@exept.de>
parents:
1887
diff
changeset
|
742 |
|
ef0f346b8f43
rpm suffix is RPM-package under unix (realplayer under windows)
Claus Gittinger <cg@exept.de>
parents:
1887
diff
changeset
|
743 |
windowsSpecificTypeList |
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 |
"/ 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
|
746 |
"/ 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
|
747 |
'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
|
748 |
) |
643 | 749 |
! ! |
750 |
||
1729 | 751 |
!MIMETypes class methodsFor:'obsolete'! |
1489 | 752 |
|
2491
831417cc1e5b
Change bas spelling: parentesis to good spellinge parenthesis
Stefan Vogel <sv@exept.de>
parents:
2490
diff
changeset
|
753 |
defaultCommandForMimeType:mimeType |
831417cc1e5b
Change bas spelling: parentesis to good spellinge parenthesis
Stefan Vogel <sv@exept.de>
parents:
2490
diff
changeset
|
754 |
<resource: #obsolete> |
831417cc1e5b
Change bas spelling: parentesis to good spellinge parenthesis
Stefan Vogel <sv@exept.de>
parents:
2490
diff
changeset
|
755 |
self obsoleteMethodWarning:'use #defaultCommandTemplateToOpenMimeType:'. |
831417cc1e5b
Change bas spelling: parentesis to good spellinge parenthesis
Stefan Vogel <sv@exept.de>
parents:
2490
diff
changeset
|
756 |
|
831417cc1e5b
Change bas spelling: parentesis to good spellinge parenthesis
Stefan Vogel <sv@exept.de>
parents:
2490
diff
changeset
|
757 |
^ self defaultCommandTemplateToOpenMimeType:mimeType |
831417cc1e5b
Change bas spelling: parentesis to good spellinge parenthesis
Stefan Vogel <sv@exept.de>
parents:
2490
diff
changeset
|
758 |
|
831417cc1e5b
Change bas spelling: parentesis to good spellinge parenthesis
Stefan Vogel <sv@exept.de>
parents:
2490
diff
changeset
|
759 |
" |
2758
66e62ceecb67
comment/format in: #defaultCommandForMimeType:
Claus Gittinger <cg@exept.de>
parents:
2724
diff
changeset
|
760 |
MIMETypes defaultCommandTemplateToOpenMimeType:'application/pdf' |
2491
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 |
|
831417cc1e5b
Change bas spelling: parentesis to good spellinge parenthesis
Stefan Vogel <sv@exept.de>
parents:
2490
diff
changeset
|
763 |
"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
|
764 |
"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
|
765 |
! |
831417cc1e5b
Change bas spelling: parentesis to good spellinge parenthesis
Stefan Vogel <sv@exept.de>
parents:
2490
diff
changeset
|
766 |
|
1729 | 767 |
fontForCharset:aCharSetName |
768 |
"return the font-encoding for an iso-charset" |
|
1489 | 769 |
|
1981 | 770 |
<resource:#obsolete> |
1729 | 771 |
self obsoleteMethodWarning:'use FontDescription >> fontNamePatternForCharset:'. |
772 |
^ FontDescription fontNamePatternForCharset:aCharSetName. |
|
1489 | 773 |
|
774 |
" |
|
1729 | 775 |
MIMETypes fontForCharset:'iso2022-jp' |
776 |
MIMETypes fontForCharset:'euc-jp' |
|
1472 | 777 |
" |
778 |
||
1729 | 779 |
"Modified: / 1.8.1998 / 17:00:57 / cg" |
780 |
! ! |
|
1472 | 781 |
|
1729 | 782 |
!MIMETypes class methodsFor:'queries'! |
1472 | 783 |
|
647 | 784 |
defineImageType:mimeType suffix:aSuffix reader:aReaderClass |
785 |
"register an image reader." |
|
786 |
||
787 |
aSuffix notNil ifTrue:[ |
|
788 |
self imageReaderForSuffix:aSuffix put:aReaderClass. |
|
789 |
]. |
|
790 |
||
791 |
mimeType notNil ifTrue:[ |
|
792 |
self imageReaderForType:mimeType put:aReaderClass |
|
793 |
]. |
|
794 |
||
795 |
(aSuffix notNil and:[mimeType notNil]) ifTrue:[ |
|
796 |
self mimeTypeForSuffix:aSuffix put:mimeType |
|
797 |
]. |
|
798 |
! |
|
799 |
||
3359 | 800 |
fileInfoForMimeType:mimeType |
801 |
"given a mimeType, return an info string similar to what the unix 'file' command |
|
802 |
provides. This info here is returned by systems which have no file (i.e. MSDOS) and |
|
803 |
for types of which file does not know about (smalltalk files, for example)" |
|
804 |
||
805 |
^ TypeToInfoMapping at:mimeType ifAbsent:nil |
|
806 |
||
807 |
" |
|
808 |
self fileInfoForMimeType:(MIMEType fromString:'image/gif') |
|
809 |
" |
|
810 |
! |
|
811 |
||
643 | 812 |
fileSuffixToImageReaderMapping |
1021 | 813 |
"return the suffix-to-imageReader mapping" |
814 |
||
643 | 815 |
^ FileSuffixToImageReaderClassMapping ? #() |
816 |
||
1021 | 817 |
"Modified: / 1.8.1998 / 17:00:11 / cg" |
643 | 818 |
! |
819 |
||
820 |
imageFileSuffixes |
|
1021 | 821 |
"return a collection with known file suffixes" |
822 |
||
643 | 823 |
FileSuffixToImageReaderClassMapping isNil ifTrue:[^ #()]. |
824 |
^ FileSuffixToImageReaderClassMapping keys |
|
825 |
||
1021 | 826 |
"Created: / 30.6.1997 / 22:04:48 / cg" |
827 |
"Modified: / 1.8.1998 / 17:01:26 / cg" |
|
643 | 828 |
! |
829 |
||
3014
e6d9a204da08
comment/format in: #mimeTypeForFilename:
Claus Gittinger <cg@exept.de>
parents:
3012
diff
changeset
|
830 |
mimeTypeForFilename:filenameOrString |
1272
91ba4078b690
additional mime table for filenames without suffix.
Claus Gittinger <cg@exept.de>
parents:
1269
diff
changeset
|
831 |
"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
|
832 |
|
1780
ba94d562efe8
support double-suffix such as '.tar.gz'
Claus Gittinger <cg@exept.de>
parents:
1779
diff
changeset
|
833 |
|type filename lcFilename suff suff2| |
1272
91ba4078b690
additional mime table for filenames without suffix.
Claus Gittinger <cg@exept.de>
parents:
1269
diff
changeset
|
834 |
|
3014
e6d9a204da08
comment/format in: #mimeTypeForFilename:
Claus Gittinger <cg@exept.de>
parents:
3012
diff
changeset
|
835 |
filename := filenameOrString asFilename. |
1474 | 836 |
|
837 |
lcFilename := filename baseName asLowercase. |
|
1272
91ba4078b690
additional mime table for filenames without suffix.
Claus Gittinger <cg@exept.de>
parents:
1269
diff
changeset
|
838 |
type := FilenameToTypeMapping at:lcFilename ifAbsent:nil. |
91ba4078b690
additional mime table for filenames without suffix.
Claus Gittinger <cg@exept.de>
parents:
1269
diff
changeset
|
839 |
type isNil ifTrue:[ |
91ba4078b690
additional mime table for filenames without suffix.
Claus Gittinger <cg@exept.de>
parents:
1269
diff
changeset
|
840 |
"/ allow for fallback ... |
91ba4078b690
additional mime table for filenames without suffix.
Claus Gittinger <cg@exept.de>
parents:
1269
diff
changeset
|
841 |
type := OperatingSystem mimeTypeForFilename:lcFilename. |
91ba4078b690
additional mime table for filenames without suffix.
Claus Gittinger <cg@exept.de>
parents:
1269
diff
changeset
|
842 |
"/ 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
|
843 |
"/ 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
|
844 |
"/ the OS. |
1275 | 845 |
"/ type isNil ifTrue:[ |
846 |
"/ FilenameToTypeMapping at:lcFilename put:#unknown |
|
847 |
"/ ]. |
|
1272
91ba4078b690
additional mime table for filenames without suffix.
Claus Gittinger <cg@exept.de>
parents:
1269
diff
changeset
|
848 |
]. |
91ba4078b690
additional mime table for filenames without suffix.
Claus Gittinger <cg@exept.de>
parents:
1269
diff
changeset
|
849 |
|
91ba4078b690
additional mime table for filenames without suffix.
Claus Gittinger <cg@exept.de>
parents:
1269
diff
changeset
|
850 |
type == #unknown ifTrue:[ |
91ba4078b690
additional mime table for filenames without suffix.
Claus Gittinger <cg@exept.de>
parents:
1269
diff
changeset
|
851 |
type := nil. |
91ba4078b690
additional mime table for filenames without suffix.
Claus Gittinger <cg@exept.de>
parents:
1269
diff
changeset
|
852 |
]. |
1273
7a52d4bcdb10
filenames mime query falls back to suffix query.
Claus Gittinger <cg@exept.de>
parents:
1272
diff
changeset
|
853 |
|
7a52d4bcdb10
filenames mime query falls back to suffix query.
Claus Gittinger <cg@exept.de>
parents:
1272
diff
changeset
|
854 |
type isNil ifTrue:[ |
1473 | 855 |
suff := filename suffix. |
1273
7a52d4bcdb10
filenames mime query falls back to suffix query.
Claus Gittinger <cg@exept.de>
parents:
1272
diff
changeset
|
856 |
suff size ~~ 0 ifTrue:[ |
1780
ba94d562efe8
support double-suffix such as '.tar.gz'
Claus Gittinger <cg@exept.de>
parents:
1779
diff
changeset
|
857 |
"/ sigh - special code for multiple-suffices... |
ba94d562efe8
support double-suffix such as '.tar.gz'
Claus Gittinger <cg@exept.de>
parents:
1779
diff
changeset
|
858 |
"/ .tar.gz -> tgz |
ba94d562efe8
support double-suffix such as '.tar.gz'
Claus Gittinger <cg@exept.de>
parents:
1779
diff
changeset
|
859 |
suff2 := filename withoutSuffix suffix. |
ba94d562efe8
support double-suffix such as '.tar.gz'
Claus Gittinger <cg@exept.de>
parents:
1779
diff
changeset
|
860 |
suff2 size > 0 ifTrue:[ |
ba94d562efe8
support double-suffix such as '.tar.gz'
Claus Gittinger <cg@exept.de>
parents:
1779
diff
changeset
|
861 |
type := self mimeTypeForSuffix:(suff2 , '.' , suff). |
ba94d562efe8
support double-suffix such as '.tar.gz'
Claus Gittinger <cg@exept.de>
parents:
1779
diff
changeset
|
862 |
]. |
ba94d562efe8
support double-suffix such as '.tar.gz'
Claus Gittinger <cg@exept.de>
parents:
1779
diff
changeset
|
863 |
type isNil ifTrue:[ |
ba94d562efe8
support double-suffix such as '.tar.gz'
Claus Gittinger <cg@exept.de>
parents:
1779
diff
changeset
|
864 |
type := self mimeTypeForSuffix:suff |
ba94d562efe8
support double-suffix such as '.tar.gz'
Claus Gittinger <cg@exept.de>
parents:
1779
diff
changeset
|
865 |
]. |
1273
7a52d4bcdb10
filenames mime query falls back to suffix query.
Claus Gittinger <cg@exept.de>
parents:
1272
diff
changeset
|
866 |
] |
7a52d4bcdb10
filenames mime query falls back to suffix query.
Claus Gittinger <cg@exept.de>
parents:
1272
diff
changeset
|
867 |
]. |
7a52d4bcdb10
filenames mime query falls back to suffix query.
Claus Gittinger <cg@exept.de>
parents:
1272
diff
changeset
|
868 |
|
1272
91ba4078b690
additional mime table for filenames without suffix.
Claus Gittinger <cg@exept.de>
parents:
1269
diff
changeset
|
869 |
^ type |
1780
ba94d562efe8
support double-suffix such as '.tar.gz'
Claus Gittinger <cg@exept.de>
parents:
1779
diff
changeset
|
870 |
|
ba94d562efe8
support double-suffix such as '.tar.gz'
Claus Gittinger <cg@exept.de>
parents:
1779
diff
changeset
|
871 |
" |
2820 | 872 |
MIMETypes mimeTypeForFilename:'typeinst.dvi' |
873 |
MIMETypes mimeTypeForFilename:'foo.tar' |
|
874 |
MIMETypes mimeTypeForFilename:'foo.tgz' |
|
875 |
MIMETypes mimeTypeForFilename:'foo.tar.gz' |
|
2911
7afaf1fdae8b
comment/format in: #mimeTypeForFilename:
Claus Gittinger <cg@exept.de>
parents:
2904
diff
changeset
|
876 |
MIMETypes mimeTypeForFilename:'foo.txt' |
1780
ba94d562efe8
support double-suffix such as '.tar.gz'
Claus Gittinger <cg@exept.de>
parents:
1779
diff
changeset
|
877 |
" |
2911
7afaf1fdae8b
comment/format in: #mimeTypeForFilename:
Claus Gittinger <cg@exept.de>
parents:
2904
diff
changeset
|
878 |
|
7afaf1fdae8b
comment/format in: #mimeTypeForFilename:
Claus Gittinger <cg@exept.de>
parents:
2904
diff
changeset
|
879 |
"Modified: / 10-05-2011 / 11:55:18 / cg" |
3014
e6d9a204da08
comment/format in: #mimeTypeForFilename:
Claus Gittinger <cg@exept.de>
parents:
3012
diff
changeset
|
880 |
"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
|
881 |
! |
91ba4078b690
additional mime table for filenames without suffix.
Claus Gittinger <cg@exept.de>
parents:
1269
diff
changeset
|
882 |
|
91ba4078b690
additional mime table for filenames without suffix.
Claus Gittinger <cg@exept.de>
parents:
1269
diff
changeset
|
883 |
mimeTypeForFilename:filename put:mimeType |
91ba4078b690
additional mime table for filenames without suffix.
Claus Gittinger <cg@exept.de>
parents:
1269
diff
changeset
|
884 |
"register a mime type for a filename" |
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 |
FilenameToTypeMapping isNil ifTrue:[ |
91ba4078b690
additional mime table for filenames without suffix.
Claus Gittinger <cg@exept.de>
parents:
1269
diff
changeset
|
887 |
FilenameToTypeMapping := Dictionary new |
91ba4078b690
additional mime table for filenames without suffix.
Claus Gittinger <cg@exept.de>
parents:
1269
diff
changeset
|
888 |
]. |
1612 | 889 |
FilenameToTypeMapping at:filename put:(MIMEType fromString:mimeType asLowercase) |
1611 | 890 |
! |
891 |
||
643 | 892 |
mimeTypeForSuffix:suffix |
1021 | 893 |
"given a file suffix, return the mime-type" |
894 |
||
1180
c3309b30d14f
code cleanup & added mimeType aquire fallBack via OS
Claus Gittinger <cg@exept.de>
parents:
1023
diff
changeset
|
895 |
|type lcSuffix| |
c3309b30d14f
code cleanup & added mimeType aquire fallBack via OS
Claus Gittinger <cg@exept.de>
parents:
1023
diff
changeset
|
896 |
|
1837 | 897 |
suffix = LastSuffix ifTrue:[ |
898 |
^ LastType |
|
899 |
]. |
|
900 |
||
1180
c3309b30d14f
code cleanup & added mimeType aquire fallBack via OS
Claus Gittinger <cg@exept.de>
parents:
1023
diff
changeset
|
901 |
lcSuffix := suffix asLowercase. |
1837 | 902 |
type := FileSuffixToTypeMapping at:lcSuffix ifAbsent:nil. |
903 |
type isNil ifTrue:[ |
|
904 |
"/ allow for fallback ... |
|
905 |
type := OperatingSystem mimeTypeForSuffix:lcSuffix. |
|
906 |
"/ the special value #unknown is returned as nil; |
|
907 |
"/ this avoids constant retry if a mimeType is not known in the OS. |
|
908 |
||
909 |
type := type ? #unknown. |
|
910 |
FileSuffixToTypeMapping at:lcSuffix put:type. |
|
1180
c3309b30d14f
code cleanup & added mimeType aquire fallBack via OS
Claus Gittinger <cg@exept.de>
parents:
1023
diff
changeset
|
911 |
]. |
1837 | 912 |
|
1180
c3309b30d14f
code cleanup & added mimeType aquire fallBack via OS
Claus Gittinger <cg@exept.de>
parents:
1023
diff
changeset
|
913 |
type == #unknown ifTrue:[ |
1837 | 914 |
type := nil. |
1180
c3309b30d14f
code cleanup & added mimeType aquire fallBack via OS
Claus Gittinger <cg@exept.de>
parents:
1023
diff
changeset
|
915 |
]. |
1840 | 916 |
type notNil ifTrue:[ |
917 |
LastSuffix := suffix. |
|
918 |
LastType := MIMEType fromString:type. |
|
919 |
^ LastType |
|
920 |
]. |
|
1841 | 921 |
^ type |
643 | 922 |
|
1666 | 923 |
" |
1840 | 924 |
self mimeTypeForSuffix:'gif' |
1888
ef0f346b8f43
rpm suffix is RPM-package under unix (realplayer under windows)
Claus Gittinger <cg@exept.de>
parents:
1887
diff
changeset
|
925 |
self mimeTypeForSuffix:'rpm' |
2891 | 926 |
self mimeTypeForSuffix:'zip' |
1666 | 927 |
" |
928 |
||
2891 | 929 |
"Created: / 30-06-1997 / 21:55:51 / cg" |
930 |
"Modified: / 14-02-2011 / 17:14:34 / cg" |
|
643 | 931 |
! |
932 |
||
933 |
mimeTypeForSuffix:suffix put:mimeType |
|
1021 | 934 |
"register a mime type for a file suffix" |
935 |
||
643 | 936 |
FileSuffixToTypeMapping isNil ifTrue:[ |
937 |
FileSuffixToTypeMapping := Dictionary new |
|
938 |
]. |
|
939 |
FileSuffixToTypeMapping at:suffix put:mimeType asLowercase |
|
940 |
||
1021 | 941 |
"Created: / 30.6.1997 / 21:56:20 / cg" |
942 |
"Modified: / 1.8.1998 / 17:03:18 / cg" |
|
1593 | 943 |
! |
944 |
||
945 |
mimeTypeForSuffixMapping |
|
946 |
||
947 |
^ FileSuffixToTypeMapping |
|
1611 | 948 |
! |
949 |
||
2023 | 950 |
mimeTypeFromString:mimeTypeString |
951 |
"given a mime-type for a string" |
|
952 |
||
953 |
^ MIMEType fromString:mimeTypeString |
|
954 |
||
955 |
" |
|
956 |
self mimeTypeFromString:'image/gif' |
|
2487
eaa224da42fa
mimeType: x-expecco-testsuite (extension: ets)
Claus Gittinger <cg@exept.de>
parents:
2486
diff
changeset
|
957 |
self mimeTypeFromString:'application/x-expecco-testsuite' |
2023 | 958 |
" |
959 |
! |
|
960 |
||
1611 | 961 |
mimeTypeOfContents:filename |
962 |
"given a filename, scan the contents, return the mime-type or nil, if unknown" |
|
963 |
||
1612 | 964 |
|typeString| |
965 |
||
966 |
typeString := filename mimeTypeOfContents. |
|
967 |
typeString isNil ifTrue:[^ nil]. |
|
968 |
^ MIMEType fromString:typeString. |
|
1887 | 969 |
! |
970 |
||
2582
298203fdb64d
mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents:
2570
diff
changeset
|
971 |
mimeTypeOfData:someData |
298203fdb64d
mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents:
2570
diff
changeset
|
972 |
"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
|
973 |
Returns nil, if unknown. |
298203fdb64d
mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents:
2570
diff
changeset
|
974 |
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
|
975 |
|
298203fdb64d
mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents:
2570
diff
changeset
|
976 |
|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
|
977 |
|
2583 | 978 |
someData isEmptyOrNil ifTrue:[^ nil]. |
979 |
||
980 |
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
|
981 |
|
298203fdb64d
mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents:
2570
diff
changeset
|
982 |
"/ read some data from the file ... |
2583 | 983 |
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
|
984 |
lcBuffer := buffer asLowercase. |
298203fdb64d
mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents:
2570
diff
changeset
|
985 |
|
298203fdb64d
mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents:
2570
diff
changeset
|
986 |
(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
|
987 |
idx := idx + 'mimetype:' size. |
298203fdb64d
mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents:
2570
diff
changeset
|
988 |
idx := lcBuffer indexOfNonSeparatorStartingAt:idx. |
298203fdb64d
mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents:
2570
diff
changeset
|
989 |
idx2 := lcBuffer indexOfSeparatorStartingAt:idx. |
298203fdb64d
mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents:
2570
diff
changeset
|
990 |
idx2 > idx ifTrue:[ |
2583 | 991 |
^ 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
|
992 |
]. |
298203fdb64d
mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents:
2570
diff
changeset
|
993 |
]. |
298203fdb64d
mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents:
2570
diff
changeset
|
994 |
|
2924 | 995 |
"/ real starters |
2582
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 |
( #[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
|
998 |
#'application/x-ms-shortcut' ) |
2924 | 999 |
( 'ITOLITLS' |
1000 |
#'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
|
1001 |
( 'WALTOP' |
298203fdb64d
mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents:
2570
diff
changeset
|
1002 |
#'application/x-waltop-digital-notepad' ) |
2892 | 1003 |
('PK' |
1004 |
#'application/x-zip-compressed') |
|
3113 | 1005 |
('<?xml' |
1006 |
#'text/xml') |
|
2582
298203fdb64d
mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents:
2570
diff
changeset
|
1007 |
) pairsDo:[:pattern :what | |
298203fdb64d
mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents:
2570
diff
changeset
|
1008 |
|patternString| |
298203fdb64d
mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents:
2570
diff
changeset
|
1009 |
|
298203fdb64d
mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents:
2570
diff
changeset
|
1010 |
patternString := pattern asString. |
298203fdb64d
mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents:
2570
diff
changeset
|
1011 |
(buffer startsWith:patternString) ifTrue:[ |
2583 | 1012 |
^ MIMEType fromString:what |
2582
298203fdb64d
mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents:
2570
diff
changeset
|
1013 |
] |
298203fdb64d
mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents:
2570
diff
changeset
|
1014 |
]. |
298203fdb64d
mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents:
2570
diff
changeset
|
1015 |
|
2924 | 1016 |
"/ 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
|
1017 |
#( |
298203fdb64d
mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents:
2570
diff
changeset
|
1018 |
('<body:' #'text/html') |
298203fdb64d
mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents:
2570
diff
changeset
|
1019 |
('%!!ps-adobe' #'application/postscript') |
298203fdb64d
mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents:
2570
diff
changeset
|
1020 |
('%PDF-' #'application/pdf') |
298203fdb64d
mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents:
2570
diff
changeset
|
1021 |
('#!! /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
|
1022 |
('#!!/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
|
1023 |
"/ ('#!! /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
|
1024 |
"/ ('#!!/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
|
1025 |
|
3113 | 1026 |
('---- encoding: ' #'application/x-smalltalk-source') |
1027 |
('---- 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
|
1028 |
('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
|
1029 |
('from visualworks' #'application/x-smalltalk-source') |
3359 | 1030 |
('from squeak' #'application/x-smalltalk-source') |
1031 |
('from smalltalk/x' #'application/x-smalltalk-source') |
|
1032 |
('"{ 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
|
1033 |
('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
|
1034 |
('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
|
1035 |
('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
|
1036 |
('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
|
1037 |
('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
|
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') |
3332 | 1040 |
('Application create:' #'application/x-smalltalk-source') |
1041 |
('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
|
1042 |
|
298203fdb64d
mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents:
2570
diff
changeset
|
1043 |
) pairsDo:[:pattern :what | |
298203fdb64d
mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents:
2570
diff
changeset
|
1044 |
(lcBuffer findString:pattern) ~~ 0 ifTrue:[ |
2583 | 1045 |
^ MIMEType fromString:what |
2582
298203fdb64d
mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents:
2570
diff
changeset
|
1046 |
] |
298203fdb64d
mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents:
2570
diff
changeset
|
1047 |
]. |
298203fdb64d
mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents:
2570
diff
changeset
|
1048 |
|
298203fdb64d
mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents:
2570
diff
changeset
|
1049 |
(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
|
1050 |
((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
|
1051 |
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
|
1052 |
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
|
1053 |
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
|
1054 |
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
|
1055 |
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
|
1056 |
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
|
1057 |
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
|
1058 |
ifTrue:[ |
2583 | 1059 |
^ 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
|
1060 |
] |
298203fdb64d
mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents:
2570
diff
changeset
|
1061 |
]. |
298203fdb64d
mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents:
2570
diff
changeset
|
1062 |
|
298203fdb64d
mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents:
2570
diff
changeset
|
1063 |
[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
|
1064 |
|
298203fdb64d
mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents:
2570
diff
changeset
|
1065 |
size == 0 ifTrue:[ |
2583 | 1066 |
^ 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
|
1067 |
]. |
298203fdb64d
mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents:
2570
diff
changeset
|
1068 |
^ nil |
2891 | 1069 |
|
2924 | 1070 |
"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
|
1071 |
! |
298203fdb64d
mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents:
2570
diff
changeset
|
1072 |
|
1887 | 1073 |
suffixForMimeType:mimeType |
1074 |
"given a file suffix, return the mime-type" |
|
1075 |
||
1076 |
^ TypeToFileSuffixMapping at:mimeType ifAbsent:nil |
|
1077 |
||
1078 |
" |
|
1079 |
self suffixForMimeType:(MIMEType fromString:'image/gif') |
|
1080 |
" |
|
1081 |
||
1082 |
"Created: / 30.6.1997 / 21:55:51 / cg" |
|
1083 |
"Modified: / 23.12.1999 / 22:30:55 / cg" |
|
1084 |
! |
|
1085 |
||
1086 |
suffixForMimeTypeString:mimeTypeString |
|
1087 |
"given a file suffix, return the mime-type" |
|
1088 |
||
1089 |
^ self suffixForMimeType:(MIMEType fromString:mimeTypeString) |
|
1090 |
||
1091 |
" |
|
1092 |
self suffixForMimeTypeString:'image/gif' |
|
1093 |
" |
|
1094 |
||
1095 |
"Created: / 30.6.1997 / 21:55:51 / cg" |
|
1096 |
"Modified: / 23.12.1999 / 22:30:55 / cg" |
|
1612 | 1097 |
! ! |
1098 |
||
2116 | 1099 |
!MIMETypes class methodsFor:'queries-applications'! |
1100 |
||
2117 | 1101 |
defaultCommandPerMIME |
1102 |
"returns the collection which is used to map MIME-type to command-templates." |
|
1103 |
||
1104 |
"TODO: move this to OS/UserPreferences" |
|
1105 |
||
1106 |
DefaultCommandPerMIMEPerOS isNil ifTrue:[ |
|
1107 |
self initializeDefaultCommands |
|
1108 |
]. |
|
1109 |
OperatingSystem isUNIXlike ifTrue:[ |
|
1110 |
^ DefaultCommandPerMIMEPerOS at:#unix |
|
1111 |
]. |
|
1112 |
^ DefaultCommandPerMIMEPerOS at:#win32 |
|
2942
693d381bc775
comment/format in: #defaultCommandPerMIME
Claus Gittinger <cg@exept.de>
parents:
2937
diff
changeset
|
1113 |
|
693d381bc775
comment/format in: #defaultCommandPerMIME
Claus Gittinger <cg@exept.de>
parents:
2937
diff
changeset
|
1114 |
" |
693d381bc775
comment/format in: #defaultCommandPerMIME
Claus Gittinger <cg@exept.de>
parents:
2937
diff
changeset
|
1115 |
MIMETypes defaultCommandPerMIME |
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 |
"Modified (comment): / 16-09-2011 / 16:20:12 / cg" |
2117 | 1119 |
! |
1120 |
||
2116 | 1121 |
defaultCommandTemplateToOpenMimeType:mimeType |
1122 |
|cmd| |
|
1123 |
||
1124 |
cmd := self defaultCommandPerMIME at:mimeType ifAbsent:nil. |
|
1125 |
cmd isNil ifTrue:[ |
|
1126 |
OperatingSystem isMSWINDOWSlike ifTrue:[ |
|
1127 |
cmd := Win32OperatingSystem::RegistryEntry commandTemplateToOpenMimeType:mimeType |
|
1128 |
]. |
|
1129 |
]. |
|
1130 |
^ cmd |
|
1131 |
||
1132 |
" |
|
1133 |
MIMETypes defaultCommandTemplateToOpenMimeType:'application/pdf' |
|
2118 | 1134 |
MIMETypes defaultCommandTemplateToOpenMimeType:'text/html' |
2116 | 1135 |
" |
1136 |
||
1137 |
"Created: / 12-05-2004 / 11:09:22 / cg" |
|
1138 |
"Modified: / 12-05-2004 / 11:16:53 / cg" |
|
1139 |
! |
|
1140 |
||
1141 |
defaultCommandTemplateToPrintMimeType:mimeType |
|
1142 |
|cmd| |
|
1143 |
||
1144 |
cmd := self defaultPrintCommandPerMIME at:mimeType ifAbsent:nil. |
|
1145 |
cmd isNil ifTrue:[ |
|
1146 |
OperatingSystem isMSWINDOWSlike ifTrue:[ |
|
1147 |
cmd := Win32OperatingSystem::RegistryEntry commandTemplateToPrintMimeType:mimeType |
|
1148 |
]. |
|
1149 |
]. |
|
1150 |
^ cmd |
|
1151 |
||
1152 |
" |
|
1153 |
MIMETypes defaultCommandTemplateToPrintMimeType:'application/pdf' |
|
1154 |
" |
|
2117 | 1155 |
! |
1156 |
||
1157 |
defaultPrintCommandPerMIME |
|
1158 |
"returns the collection which is used to map MIME-type to printing command-templates." |
|
1159 |
||
1160 |
"TODO: move this to OS/UserPreferences" |
|
1161 |
||
1162 |
DefaultPrintCommandPerMIMEPerOS isNil ifTrue:[ |
|
1163 |
self initializeDefaultCommands |
|
1164 |
]. |
|
1165 |
OperatingSystem isUNIXlike ifTrue:[ |
|
1166 |
^ DefaultPrintCommandPerMIMEPerOS at:#unix |
|
1167 |
]. |
|
1168 |
^ DefaultPrintCommandPerMIMEPerOS at:#win32 |
|
2116 | 1169 |
! ! |
1170 |
||
1729 | 1171 |
!MIMETypes class methodsFor:'queries-image formats'! |
1172 |
||
1173 |
imageReaderClasses |
|
1174 |
"return a collection of registered image reader classes" |
|
1175 |
||
1176 |
|setOfClasses| |
|
1177 |
||
1178 |
setOfClasses := IdentitySet new. |
|
1179 |
FileSuffixToImageReaderClassMapping notNil ifTrue:[ |
|
1180 |
FileSuffixToImageReaderClassMapping keysAndValuesDo:[:suff :cls | |
|
1181 |
setOfClasses add:cls |
|
1182 |
]. |
|
1183 |
]. |
|
1184 |
TypeToImageReaderClassMapping notNil ifTrue:[ |
|
1185 |
TypeToImageReaderClassMapping keysAndValuesDo:[:suff :cls | |
|
1186 |
setOfClasses add:cls |
|
1187 |
]. |
|
1188 |
]. |
|
1189 |
^ setOfClasses |
|
1190 |
||
1191 |
"Created: / 30.6.1997 / 22:03:42 / cg" |
|
1192 |
"Modified: / 1.8.1998 / 16:59:52 / cg" |
|
1193 |
! |
|
1194 |
||
1195 |
imageReaderForSuffix:aSuffix |
|
1196 |
"given a file suffix, return an approriate image reader class" |
|
1197 |
||
2724
8e834e62dbbc
Initialize when querying for image type and not yet initialized
Stefan Vogel <sv@exept.de>
parents:
2710
diff
changeset
|
1198 |
FileSuffixToImageReaderClassMapping isNil ifTrue:[ |
8e834e62dbbc
Initialize when querying for image type and not yet initialized
Stefan Vogel <sv@exept.de>
parents:
2710
diff
changeset
|
1199 |
self initializeImageReaderMappings |
8e834e62dbbc
Initialize when querying for image type and not yet initialized
Stefan Vogel <sv@exept.de>
parents:
2710
diff
changeset
|
1200 |
]. |
1729 | 1201 |
^ FileSuffixToImageReaderClassMapping at:aSuffix asLowercase ifAbsent:nil |
1202 |
||
1203 |
"Created: / 30.6.1997 / 21:59:11 / cg" |
|
1204 |
"Modified: / 1.8.1998 / 17:01:58 / cg" |
|
1205 |
! |
|
1206 |
||
1207 |
imageReaderForSuffix:aSuffix put:aReaderClass |
|
1208 |
"register an image reader for a file suffix" |
|
1209 |
||
1210 |
FileSuffixToImageReaderClassMapping isNil ifTrue:[ |
|
2724
8e834e62dbbc
Initialize when querying for image type and not yet initialized
Stefan Vogel <sv@exept.de>
parents:
2710
diff
changeset
|
1211 |
self initializeImageReaderMappings |
1729 | 1212 |
]. |
1213 |
FileSuffixToImageReaderClassMapping at:aSuffix asLowercase put:aReaderClass |
|
1214 |
||
1215 |
"Created: / 30.6.1997 / 21:59:43 / cg" |
|
1216 |
"Modified: / 1.8.1998 / 17:02:14 / cg" |
|
1217 |
! |
|
1218 |
||
1219 |
imageReaderForType:mimeTypeString |
|
1220 |
"given a mime-type, return an approriate image reader class" |
|
1221 |
||
2724
8e834e62dbbc
Initialize when querying for image type and not yet initialized
Stefan Vogel <sv@exept.de>
parents:
2710
diff
changeset
|
1222 |
TypeToImageReaderClassMapping isNil ifTrue:[ |
8e834e62dbbc
Initialize when querying for image type and not yet initialized
Stefan Vogel <sv@exept.de>
parents:
2710
diff
changeset
|
1223 |
self initializeImageReaderMappings |
8e834e62dbbc
Initialize when querying for image type and not yet initialized
Stefan Vogel <sv@exept.de>
parents:
2710
diff
changeset
|
1224 |
]. |
1729 | 1225 |
^ TypeToImageReaderClassMapping at:mimeTypeString asLowercase ifAbsent:nil |
1226 |
||
1227 |
"Created: / 30.6.1997 / 21:56:01 / cg" |
|
1228 |
"Modified: / 1.8.1998 / 17:02:28 / cg" |
|
1229 |
! |
|
1230 |
||
1231 |
imageReaderForType:mimeTypeString put:aReaderClass |
|
1232 |
"register an image reader for a mime-type" |
|
1233 |
||
1234 |
TypeToImageReaderClassMapping isNil ifTrue:[ |
|
2724
8e834e62dbbc
Initialize when querying for image type and not yet initialized
Stefan Vogel <sv@exept.de>
parents:
2710
diff
changeset
|
1235 |
self initializeImageReaderMappings |
1729 | 1236 |
]. |
1237 |
TypeToImageReaderClassMapping at:mimeTypeString asLowercase put:aReaderClass |
|
1238 |
||
1239 |
"Created: / 30.6.1997 / 21:56:11 / cg" |
|
1240 |
"Modified: / 1.8.1998 / 17:02:40 / cg" |
|
1241 |
! ! |
|
1242 |
||
1243 |
!MIMETypes class methodsFor:'queries-language syntax'! |
|
1244 |
||
1245 |
commentStringsForFilename:aFilename |
|
1246 |
"return a useful comment definition; heuristics for now. |
|
1247 |
The returned value is an array of 2 elements; |
|
1248 |
the first is the end-of-line comment string (or nil); |
|
1249 |
the second an array of opening/closing delimiters (or an array of nils)" |
|
1250 |
||
1251 |
|mime| |
|
1252 |
||
1253 |
mime := MIMETypes mimeTypeForFilename:aFilename. |
|
1254 |
^ self commentStringsForMimeType:mime suffix:(aFilename asFilename suffix) |
|
1255 |
||
1256 |
" |
|
1257 |
MIMETypes commentStringsForFilename:'Makefile'. |
|
1258 |
MIMETypes commentStringsForFilename:'Object.st'. |
|
1259 |
MIMETypes commentStringsForFilename:'Foo.java'. |
|
1925 | 1260 |
MIMETypes commentStringsForFilename:'Foo.html'. |
1729 | 1261 |
" |
1262 |
! |
|
1263 |
||
1264 |
commentStringsForFilename:aFilename ifUnknown:alternativeBlockReturningCommentString |
|
1265 |
"return a useful comment definition; heuristics for now. |
|
1266 |
The returned value is an array of 2 elements; |
|
1267 |
the first is the end-of-line comment string (or nil); |
|
1268 |
the second an array of opening/closing delimiters (or an array of nils)" |
|
1269 |
||
1270 |
|mime| |
|
1271 |
||
1272 |
mime := MIMETypes mimeTypeForFilename:aFilename. |
|
1273 |
^ self commentStringsForMimeType:mime suffix:(aFilename asFilename suffix) ifUnknown:alternativeBlockReturningCommentString |
|
1274 |
||
1275 |
" |
|
1276 |
MIMETypes commentStringsForFilename:'Makefile'. |
|
1277 |
MIMETypes commentStringsForFilename:'Object.st'. |
|
1278 |
MIMETypes commentStringsForFilename:'Foo.java'. |
|
1279 |
" |
|
1280 |
! |
|
1281 |
||
1282 |
commentStringsForMimeType:mime suffix:suff |
|
1283 |
"return a useful comment definition; heuristics for now. |
|
1284 |
The returned value is an array of 2 elements; |
|
1285 |
the first is the end-of-line comment string (or nil); |
|
1286 |
the second an array of opening/closing delimiters (or an array of nils)" |
|
1287 |
||
1288 |
^ self |
|
1289 |
commentStringsForMimeType:mime suffix:suff |
|
1290 |
ifUnknown: #(';' (nil nil)) |
|
1291 |
||
1292 |
" |
|
1293 |
|mime| |
|
1294 |
||
1295 |
mime := MIMETypes mimeTypeForFilename:'Makefile'. |
|
1296 |
MIMETypes commentStringsForMimeType:mime suffix:nil. |
|
1297 |
" |
|
1298 |
||
1299 |
" |
|
1300 |
|mime| |
|
1301 |
||
1302 |
mime := MIMETypes mimeTypeForFilename:'Object.st'. |
|
1303 |
MIMETypes commentStringsForMimeType:mime suffix:nil. |
|
1304 |
" |
|
1305 |
! |
|
1306 |
||
1307 |
commentStringsForMimeType:mime suffix:suff ifUnknown:alternativeBlockReturningCommentString |
|
1308 |
"return a useful comment definition; heuristics for now. |
|
1309 |
The returned value is an array of 2 elements; |
|
1310 |
the first is the end-of-line comment string (or nil); |
|
1311 |
the second an array of opening/closing delimiters (or an array of nils)" |
|
1312 |
||
1313 |
|commentSpec| |
|
1314 |
||
1315 |
commentSpec := TypeToCommentStringMapping at:mime ifAbsent:nil. |
|
1316 |
commentSpec notNil ifTrue:[ |
|
1317 |
^ commentSpec |
|
1318 |
]. |
|
1319 |
||
1320 |
commentSpec := SuffixToCommentStringMapping at:suff ifAbsent:nil. |
|
1321 |
commentSpec notNil ifTrue:[ |
|
1322 |
^ commentSpec |
|
1323 |
]. |
|
1324 |
||
1325 |
^ alternativeBlockReturningCommentString value |
|
1326 |
||
1327 |
" |
|
1328 |
|mime| |
|
1329 |
||
1330 |
mime := MIMETypes mimeTypeForFilename:'Makefile'. |
|
1331 |
MIMETypes commentStringsForMimeType:mime suffix:nil. |
|
1332 |
" |
|
1333 |
||
1334 |
" |
|
1335 |
|mime| |
|
1336 |
||
1337 |
mime := MIMETypes mimeTypeForFilename:'Object.st'. |
|
1338 |
MIMETypes commentStringsForMimeType:mime suffix:nil. |
|
1339 |
" |
|
2298 | 1340 |
! |
1341 |
||
2491
831417cc1e5b
Change bas spelling: parentesis to good spellinge parenthesis
Stefan Vogel <sv@exept.de>
parents:
2490
diff
changeset
|
1342 |
parenthesisSpecForFilename:aFilename |
2298 | 1343 |
"return a useful parentesis spec; heuristics for now. |
1344 |
The returned value is a dictionary to be used as parentesis spec in an editor" |
|
1345 |
||
1346 |
|mime| |
|
1347 |
||
1348 |
mime := MIMETypes mimeTypeForFilename:aFilename. |
|
2491
831417cc1e5b
Change bas spelling: parentesis to good spellinge parenthesis
Stefan Vogel <sv@exept.de>
parents:
2490
diff
changeset
|
1349 |
^ self parenthesisSpecForMimeType:mime suffix:(aFilename asFilename suffix) |
2298 | 1350 |
|
1351 |
" |
|
2491
831417cc1e5b
Change bas spelling: parentesis to good spellinge parenthesis
Stefan Vogel <sv@exept.de>
parents:
2490
diff
changeset
|
1352 |
MIMETypes parenthesisSpecForFilename:'Object.st'. |
831417cc1e5b
Change bas spelling: parentesis to good spellinge parenthesis
Stefan Vogel <sv@exept.de>
parents:
2490
diff
changeset
|
1353 |
MIMETypes parenthesisSpecForFilename:'Foo.java'. |
831417cc1e5b
Change bas spelling: parentesis to good spellinge parenthesis
Stefan Vogel <sv@exept.de>
parents:
2490
diff
changeset
|
1354 |
MIMETypes parenthesisSpecForFilename:'Foo.html'. |
831417cc1e5b
Change bas spelling: parentesis to good spellinge parenthesis
Stefan Vogel <sv@exept.de>
parents:
2490
diff
changeset
|
1355 |
MIMETypes parenthesisSpecForFilename:'Foo.lsp'. |
2298 | 1356 |
" |
1357 |
||
1358 |
"Created: / 10-04-2007 / 15:18:41 / cg" |
|
1359 |
! |
|
1360 |
||
2491
831417cc1e5b
Change bas spelling: parentesis to good spellinge parenthesis
Stefan Vogel <sv@exept.de>
parents:
2490
diff
changeset
|
1361 |
parenthesisSpecForFilename:aFilename ifUnknown:alternative |
2298 | 1362 |
|mime| |
1363 |
||
1364 |
mime := MIMETypes mimeTypeForFilename:aFilename. |
|
2491
831417cc1e5b
Change bas spelling: parentesis to good spellinge parenthesis
Stefan Vogel <sv@exept.de>
parents:
2490
diff
changeset
|
1365 |
^ self parenthesisSpecForMimeType:mime suffix:(aFilename asFilename suffix) ifUnknown:alternative |
2298 | 1366 |
|
1367 |
"Created: / 10-04-2007 / 15:26:20 / cg" |
|
1368 |
! |
|
1369 |
||
2491
831417cc1e5b
Change bas spelling: parentesis to good spellinge parenthesis
Stefan Vogel <sv@exept.de>
parents:
2490
diff
changeset
|
1370 |
parenthesisSpecForMimeType:mime suffix:suff |
2298 | 1371 |
^ self |
2491
831417cc1e5b
Change bas spelling: parentesis to good spellinge parenthesis
Stefan Vogel <sv@exept.de>
parents:
2490
diff
changeset
|
1372 |
parenthesisSpecForMimeType:mime suffix:suff |
2298 | 1373 |
ifUnknown: nil |
1374 |
||
1375 |
"Created: / 10-04-2007 / 15:19:39 / cg" |
|
1376 |
! |
|
1377 |
||
2491
831417cc1e5b
Change bas spelling: parentesis to good spellinge parenthesis
Stefan Vogel <sv@exept.de>
parents:
2490
diff
changeset
|
1378 |
parenthesisSpecForMimeType:mime suffix:suff ifUnknown:alternativeValue |
2298 | 1379 |
|spec| |
1380 |
||
2491
831417cc1e5b
Change bas spelling: parentesis to good spellinge parenthesis
Stefan Vogel <sv@exept.de>
parents:
2490
diff
changeset
|
1381 |
spec := TypeToParenthesisSpecMapping at:mime ifAbsent:nil. |
2298 | 1382 |
spec notNil ifTrue:[ |
1383 |
^ spec |
|
1384 |
]. |
|
1385 |
||
2491
831417cc1e5b
Change bas spelling: parentesis to good spellinge parenthesis
Stefan Vogel <sv@exept.de>
parents:
2490
diff
changeset
|
1386 |
spec := SuffixToParenthesisSpecMapping at:suff ifAbsent:nil. |
2298 | 1387 |
spec notNil ifTrue:[ |
1388 |
^ spec |
|
1389 |
]. |
|
1390 |
||
1391 |
^ alternativeValue value |
|
1392 |
||
1393 |
"Created: / 10-04-2007 / 15:20:38 / cg" |
|
1729 | 1394 |
! ! |
1395 |
||
1612 | 1396 |
!MIMETypes::MIMEType class methodsFor:'documentation'! |
1397 |
||
1398 |
documentation |
|
1399 |
" |
|
1864 | 1400 |
like a string, but knows that it represents a mimeType. |
3359 | 1401 |
mimetypes are singletons, remembered in the class variable CachedTypes. |
1612 | 1402 |
" |
1403 |
! ! |
|
1404 |
||
1405 |
!MIMETypes::MIMEType class methodsFor:'instance creation'! |
|
1406 |
||
1407 |
fromString:aString |
|
1408 |
|cachedType newType| |
|
1409 |
||
1410 |
aString class == self ifTrue:[^ aString]. |
|
1411 |
||
3011
f2af94d78383
delay initialization of cachedTypes
Claus Gittinger <cg@exept.de>
parents:
3008
diff
changeset
|
1412 |
CachedTypes isNil ifTrue:[ |
3012 | 1413 |
CachedTypes := Dictionary new:100. |
3011
f2af94d78383
delay initialization of cachedTypes
Claus Gittinger <cg@exept.de>
parents:
3008
diff
changeset
|
1414 |
]. |
1612 | 1415 |
cachedType := CachedTypes at:aString ifAbsent:nil. |
1416 |
cachedType notNil ifTrue:[^ cachedType]. |
|
3011
f2af94d78383
delay initialization of cachedTypes
Claus Gittinger <cg@exept.de>
parents:
3008
diff
changeset
|
1417 |
|
1612 | 1418 |
newType := aString copy changeClassTo:self. |
1419 |
CachedTypes at:aString put:newType. |
|
1420 |
^ newType |
|
1421 |
||
1422 |
" |
|
1423 |
self fromString:'text/html' |
|
1424 |
" |
|
3011
f2af94d78383
delay initialization of cachedTypes
Claus Gittinger <cg@exept.de>
parents:
3008
diff
changeset
|
1425 |
|
3012 | 1426 |
"Modified: / 20-07-2012 / 17:36:31 / cg" |
1612 | 1427 |
! ! |
1428 |
||
1429 |
!MIMETypes::MIMEType methodsFor:'queries'! |
|
1430 |
||
3359 | 1431 |
fileTypeInfo |
1432 |
^ MIMETypes fileTypeInfoForMimeType:self |
|
1433 |
||
1434 |
" |
|
1435 |
(MIMETypes mimeTypeFromString:'application/x-smalltalk-source') fileTypeInfo |
|
1436 |
" |
|
1437 |
! |
|
1438 |
||
1693 | 1439 |
isArchive |
3260 | 1440 |
<resource: #obsolete> |
1441 |
"return true, if I represent an archive type (such as zip or tar)" |
|
1442 |
||
1443 |
^ self isArchiveType |
|
1444 |
! |
|
1445 |
||
1446 |
isArchiveType |
|
1864 | 1447 |
"return true, if I represent an archive type (such as zip or tar)" |
1448 |
||
1612 | 1449 |
|archivTypes| |
1450 |
||
1729 | 1451 |
archivTypes := MIMETypes applicationCompressorsAndArchiveTypeList. |
1612 | 1452 |
archivTypes pairWiseDo:[: ext : type | |
1453 |
self = type ifTrue:[ ^ true]. |
|
1454 |
]. |
|
1455 |
^ false |
|
1456 |
! |
|
1457 |
||
2024 | 1458 |
isBinary |
3260 | 1459 |
<resource: #obsolete> |
1460 |
"return true, if I represent a binary (non-text) type" |
|
1461 |
||
1462 |
^ self isBinaryType |
|
1463 |
! |
|
1464 |
||
1465 |
isBinaryType |
|
2024 | 1466 |
"return true, if I represent a binary (non-text) type" |
1467 |
||
1468 |
^ self isTextType not |
|
1469 |
! |
|
1470 |
||
1612 | 1471 |
isHtml |
3260 | 1472 |
<resource: #obsolete> |
1473 |
"return true, if I represent the html text type" |
|
1474 |
||
1475 |
^ self isHtmlType |
|
1476 |
! |
|
1477 |
||
1478 |
isHtmlType |
|
1864 | 1479 |
"return true, if I represent the html text type" |
1612 | 1480 |
|
1481 |
^ (self = 'text/html') |
|
1482 |
! |
|
1483 |
||
1484 |
isImage |
|
3260 | 1485 |
<resource: #obsolete> |
1486 |
"return true, if I represent an image type (such as gif or jpg)" |
|
1487 |
||
1488 |
^ self isImageType |
|
1489 |
! |
|
1490 |
||
1491 |
isImageType |
|
1864 | 1492 |
"return true, if I represent an image type (such as gif or jpg)" |
1612 | 1493 |
|
1693 | 1494 |
^ (self startsWith:'image/') |
1612 | 1495 |
! |
1496 |
||
1497 |
isPdf |
|
3260 | 1498 |
<resource: #obsolete> |
1499 |
"return true, if I represent the pdf type" |
|
1500 |
||
1501 |
^ self isPdfType |
|
1502 |
! |
|
1503 |
||
1504 |
isPdfType |
|
1864 | 1505 |
"return true, if I represent the pdf type" |
1506 |
||
1612 | 1507 |
^ (self = 'application/pdf') |
1508 |
! |
|
1509 |
||
1510 |
isSmalltalkSource |
|
3260 | 1511 |
<resource: #obsolete> |
1512 |
"return true, if I represent the smalltalk sourcecode type" |
|
1513 |
||
1514 |
^ self isSmalltalkSourceType |
|
1515 |
! |
|
1516 |
||
1517 |
isSmalltalkSourceType |
|
1864 | 1518 |
"return true, if I represent the smalltalk sourcecode type" |
1519 |
||
3359 | 1520 |
^ (self startsWith: 'application/x-smalltalk-source') |
1783 | 1521 |
! |
1522 |
||
2024 | 1523 |
isTextType |
1524 |
"return true, if I represent some text type" |
|
1525 |
||
1526 |
^ self startsWith:'text/' |
|
1527 |
! |
|
1528 |
||
1783 | 1529 |
isXml |
3260 | 1530 |
<resource: #obsolete> |
1531 |
"return true, if I represent the xml text type" |
|
1532 |
||
1533 |
^ self isXmlType |
|
1534 |
! |
|
1535 |
||
1536 |
isXmlType |
|
1864 | 1537 |
"return true, if I represent the xml text type" |
1538 |
||
1783 | 1539 |
^ (self = 'text/xml') |
2490 | 1540 |
! |
1541 |
||
1542 |
suffix |
|
1543 |
^ MIMETypes suffixForMimeType:self |
|
1544 |
||
1545 |
" |
|
1546 |
(MIMETypes mimeTypeFromString:'application/x-expecco-testsuite') suffix |
|
1547 |
" |
|
643 | 1548 |
! ! |
1549 |
||
1550 |
!MIMETypes class methodsFor:'documentation'! |
|
1551 |
||
1552 |
version |
|
3367 | 1553 |
^ '$Header: /cvs/stx/stx/libview2/MIMETypes.st,v 1.136 2014-09-16 14:56:08 cg Exp $' |
2758
66e62ceecb67
comment/format in: #defaultCommandForMimeType:
Claus Gittinger <cg@exept.de>
parents:
2724
diff
changeset
|
1554 |
! |
66e62ceecb67
comment/format in: #defaultCommandForMimeType:
Claus Gittinger <cg@exept.de>
parents:
2724
diff
changeset
|
1555 |
|
66e62ceecb67
comment/format in: #defaultCommandForMimeType:
Claus Gittinger <cg@exept.de>
parents:
2724
diff
changeset
|
1556 |
version_CVS |
3367 | 1557 |
^ '$Header: /cvs/stx/stx/libview2/MIMETypes.st,v 1.136 2014-09-16 14:56:08 cg Exp $' |
643 | 1558 |
! ! |
1666 | 1559 |
|
3104 | 1560 |
|
643 | 1561 |
MIMETypes initialize! |