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