Archiver.st
author Claus Gittinger <cg@exept.de>
Sat, 02 May 2020 21:40:13 +0200
changeset 5476 7355a4b11cb6
parent 5398 e2e877f8a72d
permissions -rw-r--r--
#FEATURE by cg class: Socket class added: #newTCPclientToHost:port:domain:domainOrder:withTimeout: changed: #newTCPclientToHost:port:domain:withTimeout:
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1554
a92694a00c33 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1479
diff changeset
     1
"
5370
b868e173b9fd #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5369
diff changeset
     2
 COPYRIGHT (c) 2002 by eXept Software AG
1591
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
     3
              All Rights Reserved
1554
a92694a00c33 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1479
diff changeset
     4
a92694a00c33 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1479
diff changeset
     5
 This software is furnished under a license and may be used
a92694a00c33 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1479
diff changeset
     6
 only in accordance with the terms of that license and with the
a92694a00c33 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1479
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
a92694a00c33 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1479
diff changeset
     8
 be provided or otherwise made available to, or used by, any
a92694a00c33 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1479
diff changeset
     9
 other person.  No title to or ownership of the software is
a92694a00c33 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1479
diff changeset
    10
 hereby transferred.
a92694a00c33 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1479
diff changeset
    11
"
1085
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
    12
"{ Package: 'stx:libbasic2' }"
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
    13
3471
d5640127d17a class: Archiver
Claus Gittinger <cg@exept.de>
parents: 3436
diff changeset
    14
"{ NameSpace: Smalltalk }"
d5640127d17a class: Archiver
Claus Gittinger <cg@exept.de>
parents: 3436
diff changeset
    15
1085
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
    16
Object subclass:#Archiver
1089
128ba2ef5505 next stage
penk
parents: 1088
diff changeset
    17
	instanceVariableNames:'process temporaryDirectory fileName outStream errorStream
5368
17fbe26c92e3 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5221
diff changeset
    18
		synchronous useBuiltinArchiver'
1591
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
    19
	classVariableNames:'MimeTypeMapping'
1089
128ba2ef5505 next stage
penk
parents: 1088
diff changeset
    20
	poolDictionaries:''
128ba2ef5505 next stage
penk
parents: 1088
diff changeset
    21
	category:'System-Support-FileFormats'
1085
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
    22
!
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
    23
1383
527dcd29a97b added ar-archive (unix object-libraries)
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
    24
Archiver subclass:#MultiFileArchive
527dcd29a97b added ar-archive (unix object-libraries)
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
    25
	instanceVariableNames:''
527dcd29a97b added ar-archive (unix object-libraries)
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
    26
	classVariableNames:''
527dcd29a97b added ar-archive (unix object-libraries)
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
    27
	poolDictionaries:''
527dcd29a97b added ar-archive (unix object-libraries)
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
    28
	privateIn:Archiver
527dcd29a97b added ar-archive (unix object-libraries)
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
    29
!
527dcd29a97b added ar-archive (unix object-libraries)
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
    30
1246
1eefc3a60863 output parsing refactored;
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
    31
Object subclass:#ArchiverOutputParser
1eefc3a60863 output parsing refactored;
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
    32
	instanceVariableNames:'firstLineRead archiver'
1eefc3a60863 output parsing refactored;
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
    33
	classVariableNames:''
1eefc3a60863 output parsing refactored;
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
    34
	poolDictionaries:''
1eefc3a60863 output parsing refactored;
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
    35
	privateIn:Archiver
1eefc3a60863 output parsing refactored;
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
    36
!
1eefc3a60863 output parsing refactored;
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
    37
1392
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
    38
Archiver subclass:#CompressedFile
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
    39
	instanceVariableNames:''
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
    40
	classVariableNames:''
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
    41
	poolDictionaries:''
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
    42
	privateIn:Archiver
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
    43
!
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
    44
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
    45
Archiver::CompressedFile subclass:#BZ2Compressed
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
    46
	instanceVariableNames:''
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
    47
	classVariableNames:''
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
    48
	poolDictionaries:''
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
    49
	privateIn:Archiver
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
    50
!
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
    51
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
    52
Archiver subclass:#CompressedTarArchive
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
    53
	instanceVariableNames:'tarArchiver tarFile'
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
    54
	classVariableNames:''
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
    55
	poolDictionaries:''
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
    56
	privateIn:Archiver
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
    57
!
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
    58
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
    59
Archiver::CompressedFile subclass:#GZipCompressed
1089
128ba2ef5505 next stage
penk
parents: 1088
diff changeset
    60
	instanceVariableNames:''
128ba2ef5505 next stage
penk
parents: 1088
diff changeset
    61
	classVariableNames:''
128ba2ef5505 next stage
penk
parents: 1088
diff changeset
    62
	poolDictionaries:''
128ba2ef5505 next stage
penk
parents: 1088
diff changeset
    63
	privateIn:Archiver
1085
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
    64
!
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
    65
4584
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
    66
Archiver::MultiFileArchive subclass:#LZipArchive
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
    67
	instanceVariableNames:''
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
    68
	classVariableNames:''
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
    69
	poolDictionaries:''
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
    70
	privateIn:Archiver
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
    71
!
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
    72
1383
527dcd29a97b added ar-archive (unix object-libraries)
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
    73
Archiver::MultiFileArchive subclass:#ArArchive
1215
c3fe5597c1ec refactored
Claus Gittinger <cg@exept.de>
parents: 1205
diff changeset
    74
	instanceVariableNames:''
c3fe5597c1ec refactored
Claus Gittinger <cg@exept.de>
parents: 1205
diff changeset
    75
	classVariableNames:''
c3fe5597c1ec refactored
Claus Gittinger <cg@exept.de>
parents: 1205
diff changeset
    76
	poolDictionaries:''
c3fe5597c1ec refactored
Claus Gittinger <cg@exept.de>
parents: 1205
diff changeset
    77
	privateIn:Archiver
c3fe5597c1ec refactored
Claus Gittinger <cg@exept.de>
parents: 1205
diff changeset
    78
!
c3fe5597c1ec refactored
Claus Gittinger <cg@exept.de>
parents: 1205
diff changeset
    79
c3fe5597c1ec refactored
Claus Gittinger <cg@exept.de>
parents: 1205
diff changeset
    80
Archiver::MultiFileArchive subclass:#TarArchive
1089
128ba2ef5505 next stage
penk
parents: 1088
diff changeset
    81
	instanceVariableNames:''
128ba2ef5505 next stage
penk
parents: 1088
diff changeset
    82
	classVariableNames:''
128ba2ef5505 next stage
penk
parents: 1088
diff changeset
    83
	poolDictionaries:''
128ba2ef5505 next stage
penk
parents: 1088
diff changeset
    84
	privateIn:Archiver
1085
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
    85
!
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
    86
1392
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
    87
Archiver::CompressedTarArchive subclass:#TarBZ2Archive
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
    88
	instanceVariableNames:''
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
    89
	classVariableNames:''
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
    90
	poolDictionaries:''
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
    91
	privateIn:Archiver
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
    92
!
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
    93
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
    94
Archiver::CompressedTarArchive subclass:#TarGZipArchive
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
    95
	instanceVariableNames:''
1089
128ba2ef5505 next stage
penk
parents: 1088
diff changeset
    96
	classVariableNames:''
128ba2ef5505 next stage
penk
parents: 1088
diff changeset
    97
	poolDictionaries:''
128ba2ef5505 next stage
penk
parents: 1088
diff changeset
    98
	privateIn:Archiver
1085
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
    99
!
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   100
4103
d2f19ff163dc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
   101
Archiver::MultiFileArchive subclass:#XarArchive
d2f19ff163dc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
   102
	instanceVariableNames:''
d2f19ff163dc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
   103
	classVariableNames:''
d2f19ff163dc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
   104
	poolDictionaries:''
d2f19ff163dc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
   105
	privateIn:Archiver
d2f19ff163dc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
   106
!
d2f19ff163dc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
   107
1215
c3fe5597c1ec refactored
Claus Gittinger <cg@exept.de>
parents: 1205
diff changeset
   108
Archiver::MultiFileArchive subclass:#ZipArchive
1089
128ba2ef5505 next stage
penk
parents: 1088
diff changeset
   109
	instanceVariableNames:''
128ba2ef5505 next stage
penk
parents: 1088
diff changeset
   110
	classVariableNames:''
128ba2ef5505 next stage
penk
parents: 1088
diff changeset
   111
	poolDictionaries:''
128ba2ef5505 next stage
penk
parents: 1088
diff changeset
   112
	privateIn:Archiver
1086
2af5aca23dba zip added
penk
parents: 1085
diff changeset
   113
!
2af5aca23dba zip added
penk
parents: 1085
diff changeset
   114
1554
a92694a00c33 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1479
diff changeset
   115
!Archiver class methodsFor:'documentation'!
a92694a00c33 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1479
diff changeset
   116
a92694a00c33 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1479
diff changeset
   117
copyright
a92694a00c33 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1479
diff changeset
   118
"
5370
b868e173b9fd #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5369
diff changeset
   119
 COPYRIGHT (c) 2002 by eXept Software AG
1591
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
   120
              All Rights Reserved
1554
a92694a00c33 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1479
diff changeset
   121
a92694a00c33 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1479
diff changeset
   122
 This software is furnished under a license and may be used
a92694a00c33 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1479
diff changeset
   123
 only in accordance with the terms of that license and with the
a92694a00c33 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1479
diff changeset
   124
 inclusion of the above copyright notice.   This software may not
a92694a00c33 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1479
diff changeset
   125
 be provided or otherwise made available to, or used by, any
a92694a00c33 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1479
diff changeset
   126
 other person.  No title to or ownership of the software is
a92694a00c33 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1479
diff changeset
   127
 hereby transferred.
a92694a00c33 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1479
diff changeset
   128
"
2646
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
   129
!
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
   130
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
   131
documentation
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
   132
"
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
   133
    this is a soon to be obsoleted helper class for the fileBrowser.
3007
778a3c6b9877 class: Archiver
Claus Gittinger <cg@exept.de>
parents: 2907
diff changeset
   134
    it wraps OS-specific command line archivers (tar, zip, rar, etc)
2646
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
   135
    into a common protocol useful to display an archive's contents.
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
   136
3007
778a3c6b9877 class: Archiver
Claus Gittinger <cg@exept.de>
parents: 2907
diff changeset
   137
    will be removed - do not use for your projects.
2646
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
   138
"
1554
a92694a00c33 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1479
diff changeset
   139
! !
1085
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   140
1591
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
   141
!Archiver class methodsFor:'initialization'!
1392
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   142
3794
7521fb1589fd #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 3787
diff changeset
   143
initializeMimeTypeMapping
2689
916e23097292 changed: #initialize
Claus Gittinger <cg@exept.de>
parents: 2688
diff changeset
   144
    MimeTypeMapping := Dictionary 
916e23097292 changed: #initialize
Claus Gittinger <cg@exept.de>
parents: 2688
diff changeset
   145
        withKeysAndValues:
916e23097292 changed: #initialize
Claus Gittinger <cg@exept.de>
parents: 2688
diff changeset
   146
            #(
916e23097292 changed: #initialize
Claus Gittinger <cg@exept.de>
parents: 2688
diff changeset
   147
                'application/x-tar-compressed'         CompressedTarArchive     "abstract - special handling"
916e23097292 changed: #initialize
Claus Gittinger <cg@exept.de>
parents: 2688
diff changeset
   148
                'application/x-tar-gzip-compressed'    TarGZipArchive       
916e23097292 changed: #initialize
Claus Gittinger <cg@exept.de>
parents: 2688
diff changeset
   149
                'application/x-tar-bzip2-compressed'   TarBZ2Archive        
916e23097292 changed: #initialize
Claus Gittinger <cg@exept.de>
parents: 2688
diff changeset
   150
                'application/x-tar'                    TarArchive          
916e23097292 changed: #initialize
Claus Gittinger <cg@exept.de>
parents: 2688
diff changeset
   151
                'application/x-gzip-compressed'        GZipCompressed      
4584
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
   152
                'application/gzip'                     GZipCompressed      
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
   153
                'application/lzip'                     LZipArchive      
2689
916e23097292 changed: #initialize
Claus Gittinger <cg@exept.de>
parents: 2688
diff changeset
   154
                'application/x-zip-compressed'         ZipArchive          
916e23097292 changed: #initialize
Claus Gittinger <cg@exept.de>
parents: 2688
diff changeset
   155
                'application/x-bzip2-compressed'       BZ2Compressed       
916e23097292 changed: #initialize
Claus Gittinger <cg@exept.de>
parents: 2688
diff changeset
   156
                'application/x-squeak-archive'         ZipArchive          
2693
d6750d5e8160 changed: #initialize
Claus Gittinger <cg@exept.de>
parents: 2690
diff changeset
   157
                'application/x-squeak-monticello-archive'     ZipArchive          
2689
916e23097292 changed: #initialize
Claus Gittinger <cg@exept.de>
parents: 2688
diff changeset
   158
                'application/java-archive'             ZipArchive          
4103
d2f19ff163dc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
   159
                'application/x-xar'                    XarArchive "/ on OSX         
1591
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
   160
2689
916e23097292 changed: #initialize
Claus Gittinger <cg@exept.de>
parents: 2688
diff changeset
   161
                'application/x-ar-archive'             ArArchive           
916e23097292 changed: #initialize
Claus Gittinger <cg@exept.de>
parents: 2688
diff changeset
   162
                'application/x-ar-library'             ArArchive           
916e23097292 changed: #initialize
Claus Gittinger <cg@exept.de>
parents: 2688
diff changeset
   163
                'application/library'                  ArArchive           
1591
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
   164
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
   165
"/       'application/x-rpm'                    RPMArchive          
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
   166
"/       'application/x-rpm-archive'            RPMArchive          
2688
e97785830190 changed: #initialize
Claus Gittinger <cg@exept.de>
parents: 2646
diff changeset
   167
"/       'application/x-redhat packet manager'  RPMArchive  
e97785830190 changed: #initialize
Claus Gittinger <cg@exept.de>
parents: 2646
diff changeset
   168
2689
916e23097292 changed: #initialize
Claus Gittinger <cg@exept.de>
parents: 2688
diff changeset
   169
                'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' ZipArchive
3471
d5640127d17a class: Archiver
Claus Gittinger <cg@exept.de>
parents: 3436
diff changeset
   170
d5640127d17a class: Archiver
Claus Gittinger <cg@exept.de>
parents: 3436
diff changeset
   171
                'application/x-expecco-testsuite'   ZipArchive
2689
916e23097292 changed: #initialize
Claus Gittinger <cg@exept.de>
parents: 2688
diff changeset
   172
            ).
2688
e97785830190 changed: #initialize
Claus Gittinger <cg@exept.de>
parents: 2646
diff changeset
   173
2693
d6750d5e8160 changed: #initialize
Claus Gittinger <cg@exept.de>
parents: 2690
diff changeset
   174
    "Modified: / 01-12-2011 / 21:25:08 / cg"
1591
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
   175
! !
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
   176
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
   177
!Archiver class methodsFor:'instance creation'!
1392
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   178
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   179
classForMimeType:aMimeType fileName:aFileNameOrNil
1215
c3fe5597c1ec refactored
Claus Gittinger <cg@exept.de>
parents: 1205
diff changeset
   180
    |className|
c3fe5597c1ec refactored
Claus Gittinger <cg@exept.de>
parents: 1205
diff changeset
   181
3794
7521fb1589fd #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 3787
diff changeset
   182
    MimeTypeMapping isNil ifTrue:[
7521fb1589fd #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 3787
diff changeset
   183
        self initializeMimeTypeMapping
7521fb1589fd #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 3787
diff changeset
   184
    ].    
2694
253225aabd59 changed: #classForMimeType:fileName:
Claus Gittinger <cg@exept.de>
parents: 2693
diff changeset
   185
    className := MimeTypeMapping at:aMimeType ifAbsent:nil.
253225aabd59 changed: #classForMimeType:fileName:
Claus Gittinger <cg@exept.de>
parents: 2693
diff changeset
   186
    className isNil ifTrue:[
253225aabd59 changed: #classForMimeType:fileName:
Claus Gittinger <cg@exept.de>
parents: 2693
diff changeset
   187
        "/ hard coded heuristics...
253225aabd59 changed: #classForMimeType:fileName:
Claus Gittinger <cg@exept.de>
parents: 2693
diff changeset
   188
        aFileNameOrNil asFilename suffix = 'mcz' ifTrue:[^ ZipArchive].
253225aabd59 changed: #classForMimeType:fileName:
Claus Gittinger <cg@exept.de>
parents: 2693
diff changeset
   189
        ^ nil
253225aabd59 changed: #classForMimeType:fileName:
Claus Gittinger <cg@exept.de>
parents: 2693
diff changeset
   190
    ].
1392
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   191
1591
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
   192
    className = #CompressedTarArchive ifTrue:[
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
   193
        (aFileNameOrNil notNil and:[aFileNameOrNil suffix = 'bz2']) ifTrue:[
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
   194
            className := #TarBZ2Archive
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
   195
        ] ifFalse:[
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
   196
            "this is the default"
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
   197
            className := #TarGZipArchive
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
   198
        ]
1392
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   199
    ].
1215
c3fe5597c1ec refactored
Claus Gittinger <cg@exept.de>
parents: 1205
diff changeset
   200
    ^ self privateClassesAt:className.
c3fe5597c1ec refactored
Claus Gittinger <cg@exept.de>
parents: 1205
diff changeset
   201
c3fe5597c1ec refactored
Claus Gittinger <cg@exept.de>
parents: 1205
diff changeset
   202
    "
1591
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
   203
     self classForMimeType:nil fileName:nil   
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
   204
     self classForMimeType:'application/x-tar-compressed' fileName:nil   
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
   205
     self classForMimeType:'application/x-tar' fileName:nil   
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
   206
     self classForMimeType:'application/x-foo' fileName:nil   
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
   207
     self classForMimeType:'application/x-squeak-archive' fileName:nil  
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
   208
     self classForMimeType:'application/java-archive' fileName:nil 
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
   209
     'foo.sar' asFilename mimeTypeFromName               
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
   210
     'foo.jar' asFilename mimeTypeFromName               
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
   211
     'foo.a' asFilename mimeTypeFromName               
1215
c3fe5597c1ec refactored
Claus Gittinger <cg@exept.de>
parents: 1205
diff changeset
   212
    "
2694
253225aabd59 changed: #classForMimeType:fileName:
Claus Gittinger <cg@exept.de>
parents: 2693
diff changeset
   213
253225aabd59 changed: #classForMimeType:fileName:
Claus Gittinger <cg@exept.de>
parents: 2693
diff changeset
   214
    "Modified: / 01-12-2011 / 21:26:24 / cg"
1215
c3fe5597c1ec refactored
Claus Gittinger <cg@exept.de>
parents: 1205
diff changeset
   215
!
c3fe5597c1ec refactored
Claus Gittinger <cg@exept.de>
parents: 1205
diff changeset
   216
c3fe5597c1ec refactored
Claus Gittinger <cg@exept.de>
parents: 1205
diff changeset
   217
newFor:aFilename
4771
994d4aaf474d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4637
diff changeset
   218
    |fn mimeType archiverClass|
1215
c3fe5597c1ec refactored
Claus Gittinger <cg@exept.de>
parents: 1205
diff changeset
   219
1392
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   220
    fn := aFilename asFilename.
4771
994d4aaf474d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4637
diff changeset
   221
    (mimeType := fn mimeTypeFromName) isNil ifTrue:[
994d4aaf474d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4637
diff changeset
   222
        (mimeType := fn mimeTypeOfContents) isNil ifTrue:[
994d4aaf474d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4637
diff changeset
   223
            self breakPoint:#cg.
994d4aaf474d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4637
diff changeset
   224
        ].
994d4aaf474d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4637
diff changeset
   225
    ].        
994d4aaf474d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4637
diff changeset
   226
    mimeType = 'application/x-zip-compressed' ifTrue:[
994d4aaf474d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4637
diff changeset
   227
        self breakPoint:#cg.
994d4aaf474d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4637
diff changeset
   228
    ].
994d4aaf474d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4637
diff changeset
   229
    
994d4aaf474d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4637
diff changeset
   230
    archiverClass := self classForMimeType:mimeType fileName:fn.
1215
c3fe5597c1ec refactored
Claus Gittinger <cg@exept.de>
parents: 1205
diff changeset
   231
    archiverClass isNil ifTrue:[^ nil].
1591
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
   232
    ^ archiverClass with:fn
4771
994d4aaf474d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4637
diff changeset
   233
994d4aaf474d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4637
diff changeset
   234
    "Modified: / 28-11-2018 / 15:31:31 / Claus Gittinger"
1215
c3fe5597c1ec refactored
Claus Gittinger <cg@exept.de>
parents: 1205
diff changeset
   235
!
c3fe5597c1ec refactored
Claus Gittinger <cg@exept.de>
parents: 1205
diff changeset
   236
1085
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   237
with:aFilename
1591
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
   238
    ^ self new fileName:aFilename.
1085
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   239
! !
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   240
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   241
!Archiver class methodsFor:'classAccess'!
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   242
1383
527dcd29a97b added ar-archive (unix object-libraries)
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
   243
arArchive
527dcd29a97b added ar-archive (unix object-libraries)
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
   244
527dcd29a97b added ar-archive (unix object-libraries)
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
   245
    ^ ArArchive
527dcd29a97b added ar-archive (unix object-libraries)
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
   246
!
527dcd29a97b added ar-archive (unix object-libraries)
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
   247
1085
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   248
gzipArchive
1392
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   249
    ^ GZipCompressed
1085
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   250
!
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   251
4584
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
   252
lzipArchive
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
   253
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
   254
    ^ LZipArchive
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
   255
!
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
   256
1085
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   257
tarArchive
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   258
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   259
    ^ TarArchive
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   260
!
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   261
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   262
tarGZipArchive
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   263
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   264
    ^ TarGZipArchive
1086
2af5aca23dba zip added
penk
parents: 1085
diff changeset
   265
!
2af5aca23dba zip added
penk
parents: 1085
diff changeset
   266
2af5aca23dba zip added
penk
parents: 1085
diff changeset
   267
zipArchive
2af5aca23dba zip added
penk
parents: 1085
diff changeset
   268
2af5aca23dba zip added
penk
parents: 1085
diff changeset
   269
    ^ ZipArchive
1085
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   270
! !
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   271
1246
1eefc3a60863 output parsing refactored;
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
   272
!Archiver class methodsFor:'columns'!
1eefc3a60863 output parsing refactored;
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
   273
1eefc3a60863 output parsing refactored;
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
   274
columns
1eefc3a60863 output parsing refactored;
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
   275
    self subclassResponsibility
1eefc3a60863 output parsing refactored;
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
   276
! !
1eefc3a60863 output parsing refactored;
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
   277
1255
32e0aa97ae82 gzip archiver stuff fixed.
Claus Gittinger <cg@exept.de>
parents: 1247
diff changeset
   278
!Archiver class methodsFor:'command strings'!
32e0aa97ae82 gzip archiver stuff fixed.
Claus Gittinger <cg@exept.de>
parents: 1247
diff changeset
   279
32e0aa97ae82 gzip archiver stuff fixed.
Claus Gittinger <cg@exept.de>
parents: 1247
diff changeset
   280
stringWithQuotedFileBaseNames:aColOfFiles
32e0aa97ae82 gzip archiver stuff fixed.
Claus Gittinger <cg@exept.de>
parents: 1247
diff changeset
   281
32e0aa97ae82 gzip archiver stuff fixed.
Claus Gittinger <cg@exept.de>
parents: 1247
diff changeset
   282
    aColOfFiles isNil ifTrue:[^ ''].
32e0aa97ae82 gzip archiver stuff fixed.
Claus Gittinger <cg@exept.de>
parents: 1247
diff changeset
   283
1591
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
   284
    ^ String 
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
   285
        streamContents:[:str |
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
   286
            aColOfFiles do:[:fn | 
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
   287
                str nextPutAll:' "'.
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
   288
                str nextPutAll:(fn asFilename baseName).
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
   289
                str nextPutAll:'"'.
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
   290
            ].
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
   291
        ]
1255
32e0aa97ae82 gzip archiver stuff fixed.
Claus Gittinger <cg@exept.de>
parents: 1247
diff changeset
   292
! !
32e0aa97ae82 gzip archiver stuff fixed.
Claus Gittinger <cg@exept.de>
parents: 1247
diff changeset
   293
1246
1eefc3a60863 output parsing refactored;
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
   294
!Archiver class methodsFor:'commandOutputReader'!
1eefc3a60863 output parsing refactored;
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
   295
1eefc3a60863 output parsing refactored;
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
   296
commandOutputParser
1eefc3a60863 output parsing refactored;
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
   297
    ^ self commandOutputParserClass new
1eefc3a60863 output parsing refactored;
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
   298
!
1eefc3a60863 output parsing refactored;
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
   299
1eefc3a60863 output parsing refactored;
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
   300
commandOutputParserClass
1eefc3a60863 output parsing refactored;
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
   301
    ^ ArchiverOutputParser
1eefc3a60863 output parsing refactored;
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
   302
! !
1eefc3a60863 output parsing refactored;
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
   303
1086
2af5aca23dba zip added
penk
parents: 1085
diff changeset
   304
!Archiver class methodsFor:'queries'!
2af5aca23dba zip added
penk
parents: 1085
diff changeset
   305
2af5aca23dba zip added
penk
parents: 1085
diff changeset
   306
canAddFiles
2af5aca23dba zip added
penk
parents: 1085
diff changeset
   307
2af5aca23dba zip added
penk
parents: 1085
diff changeset
   308
    ^ false
2af5aca23dba zip added
penk
parents: 1085
diff changeset
   309
!
2af5aca23dba zip added
penk
parents: 1085
diff changeset
   310
1106
893c2c508df1 checkin from browser
penk
parents: 1098
diff changeset
   311
canDragnDrop
893c2c508df1 checkin from browser
penk
parents: 1098
diff changeset
   312
893c2c508df1 checkin from browser
penk
parents: 1098
diff changeset
   313
    ^ true.
893c2c508df1 checkin from browser
penk
parents: 1098
diff changeset
   314
!
893c2c508df1 checkin from browser
penk
parents: 1098
diff changeset
   315
1098
4b5a0721ec55 checkin from browser
penk
parents: 1089
diff changeset
   316
canExtractFiles
4b5a0721ec55 checkin from browser
penk
parents: 1089
diff changeset
   317
4b5a0721ec55 checkin from browser
penk
parents: 1089
diff changeset
   318
    ^ false
4b5a0721ec55 checkin from browser
penk
parents: 1089
diff changeset
   319
!
4b5a0721ec55 checkin from browser
penk
parents: 1089
diff changeset
   320
1086
2af5aca23dba zip added
penk
parents: 1085
diff changeset
   321
canRemoveFiles
2af5aca23dba zip added
penk
parents: 1085
diff changeset
   322
2af5aca23dba zip added
penk
parents: 1085
diff changeset
   323
    ^ false
2af5aca23dba zip added
penk
parents: 1085
diff changeset
   324
!
2af5aca23dba zip added
penk
parents: 1085
diff changeset
   325
1106
893c2c508df1 checkin from browser
penk
parents: 1098
diff changeset
   326
canViewFile
893c2c508df1 checkin from browser
penk
parents: 1098
diff changeset
   327
893c2c508df1 checkin from browser
penk
parents: 1098
diff changeset
   328
    ^ false
893c2c508df1 checkin from browser
penk
parents: 1098
diff changeset
   329
!
893c2c508df1 checkin from browser
penk
parents: 1098
diff changeset
   330
1086
2af5aca23dba zip added
penk
parents: 1085
diff changeset
   331
hasTitleLine
2af5aca23dba zip added
penk
parents: 1085
diff changeset
   332
2af5aca23dba zip added
penk
parents: 1085
diff changeset
   333
    ^ false
3651
abfe8e55ceaf #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 3512
diff changeset
   334
!
abfe8e55ceaf #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 3512
diff changeset
   335
abfe8e55ceaf #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 3512
diff changeset
   336
isAbstract
abfe8e55ceaf #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 3512
diff changeset
   337
    ^ self == Archiver
1086
2af5aca23dba zip added
penk
parents: 1085
diff changeset
   338
! !
2af5aca23dba zip added
penk
parents: 1085
diff changeset
   339
1085
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   340
!Archiver methodsFor:'accessing'!
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   341
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   342
errorStream
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   343
    "return the value of the instance variable 'errorStream' (automatically generated)"
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   344
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   345
    ^ errorStream
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   346
!
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   347
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   348
errorStream:something
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   349
    "set the value of the instance variable 'errorStream' (automatically generated)"
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   350
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   351
    errorStream := something.
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   352
!
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   353
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   354
fileName
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   355
    "return the value of the instance variable 'fileName' (automatically generated)"
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   356
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   357
    ^ fileName
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   358
!
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   359
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   360
fileName:something
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   361
    "set the value of the instance variable 'fileName' (automatically generated)"
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   362
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   363
    fileName := something.
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   364
!
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   365
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   366
outStream
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   367
    "return the value of the instance variable 'outStream' (automatically generated)"
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   368
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   369
    ^ outStream
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   370
!
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   371
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   372
outStream:something
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   373
    "set the value of the instance variable 'outStream' (automatically generated)"
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   374
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   375
    outStream := something.
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   376
!
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   377
4244
66c023206027 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 4219
diff changeset
   378
outStream:anOutStream errorStream:anErrorStream synchron:aBoolean
66c023206027 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 4219
diff changeset
   379
    outStream := anOutStream.
66c023206027 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 4219
diff changeset
   380
    errorStream := anErrorStream.
5368
17fbe26c92e3 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5221
diff changeset
   381
    synchronous := aBoolean
4244
66c023206027 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 4219
diff changeset
   382
!
66c023206027 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 4219
diff changeset
   383
1085
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   384
process
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   385
    "return the value of the instance variable 'process' (automatically generated)"
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   386
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   387
    ^ process
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   388
!
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   389
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   390
process:something
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   391
    "set the value of the instance variable 'process' (automatically generated)"
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   392
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   393
    process := something.
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   394
!
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   395
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   396
synchron
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   397
    "return the value of the instance variable 'synchron' (automatically generated)"
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   398
5368
17fbe26c92e3 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5221
diff changeset
   399
    ^ synchronous
1085
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   400
!
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   401
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   402
synchron:something
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   403
    "set the value of the instance variable 'synchron' (automatically generated)"
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   404
5368
17fbe26c92e3 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5221
diff changeset
   405
    synchronous := something.
1085
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   406
!
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   407
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   408
temporaryDirectory
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   409
    "return the value of the instance variable 'temporaryDirectory' (automatically generated)"
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   410
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   411
    temporaryDirectory isNil ifTrue:[
3027
552aa6706d4c class: Archiver
Stefan Vogel <sv@exept.de>
parents: 3007
diff changeset
   412
        temporaryDirectory := Filename newTemporaryDirectory.
1085
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   413
    ].
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   414
    ^ temporaryDirectory
5368
17fbe26c92e3 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5221
diff changeset
   415
!
17fbe26c92e3 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5221
diff changeset
   416
17fbe26c92e3 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5221
diff changeset
   417
useBuiltinArchiver
17fbe26c92e3 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5221
diff changeset
   418
    "by default, we use the underlying OS's command line tools to list and extract entries.
17fbe26c92e3 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5221
diff changeset
   419
     However, under windows, if no winrar/rar is installed,
17fbe26c92e3 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5221
diff changeset
   420
     we must use our builtin zip archiver.
17fbe26c92e3 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5221
diff changeset
   421
     This flag is automatically set, if we detect that situation"
17fbe26c92e3 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5221
diff changeset
   422
17fbe26c92e3 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5221
diff changeset
   423
    ^ useBuiltinArchiver ? false
17fbe26c92e3 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5221
diff changeset
   424
!
17fbe26c92e3 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5221
diff changeset
   425
17fbe26c92e3 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5221
diff changeset
   426
useBuiltinArchiver:aBoolean
17fbe26c92e3 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5221
diff changeset
   427
    "by default, we use the underlying OS's command line tools to list and extract entries.
17fbe26c92e3 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5221
diff changeset
   428
     However, under windows, if no winrar/rar is installed,
17fbe26c92e3 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5221
diff changeset
   429
     we must use our builtin zip archiver.
17fbe26c92e3 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5221
diff changeset
   430
     This flag is automatically set, if we detect that situation"
17fbe26c92e3 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5221
diff changeset
   431
17fbe26c92e3 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5221
diff changeset
   432
    useBuiltinArchiver := aBoolean
1085
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   433
! !
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   434
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   435
!Archiver methodsFor:'actions'!
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   436
1215
c3fe5597c1ec refactored
Claus Gittinger <cg@exept.de>
parents: 1205
diff changeset
   437
extractFilesTo:aDirectory
c3fe5597c1ec refactored
Claus Gittinger <cg@exept.de>
parents: 1205
diff changeset
   438
    self extractFiles:nil to:aDirectory
1085
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   439
!
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   440
4244
66c023206027 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 4219
diff changeset
   441
getCommandToListFiles:aColOfFiles
66c023206027 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 4219
diff changeset
   442
    self subclassResponsibility.
66c023206027 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 4219
diff changeset
   443
!
66c023206027 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 4219
diff changeset
   444
1255
32e0aa97ae82 gzip archiver stuff fixed.
Claus Gittinger <cg@exept.de>
parents: 1247
diff changeset
   445
listFiles:aColOfFiles
5368
17fbe26c92e3 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5221
diff changeset
   446
    |fn cmd dir|
1255
32e0aa97ae82 gzip archiver stuff fixed.
Claus Gittinger <cg@exept.de>
parents: 1247
diff changeset
   447
5368
17fbe26c92e3 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5221
diff changeset
   448
    (fn := self fileName) isNil ifTrue:[ ^ self].
17fbe26c92e3 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5221
diff changeset
   449
    dir := fn directory.
1255
32e0aa97ae82 gzip archiver stuff fixed.
Claus Gittinger <cg@exept.de>
parents: 1247
diff changeset
   450
    cmd := self getCommandToListFiles:aColOfFiles.
2646
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
   451
    cmd isNil ifTrue:[
5368
17fbe26c92e3 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5221
diff changeset
   452
        "/ no list command configured/found.
2646
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
   453
        errorStream nextPutLine:'No command to list the archive.'.
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
   454
        ^ self
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
   455
    ].
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
   456
    self executeCommand:cmd directory:dir
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
   457
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
   458
    "Modified: / 16-09-2011 / 16:33:50 / cg"
1255
32e0aa97ae82 gzip archiver stuff fixed.
Claus Gittinger <cg@exept.de>
parents: 1247
diff changeset
   459
!
32e0aa97ae82 gzip archiver stuff fixed.
Claus Gittinger <cg@exept.de>
parents: 1247
diff changeset
   460
1215
c3fe5597c1ec refactored
Claus Gittinger <cg@exept.de>
parents: 1205
diff changeset
   461
removeFilesFromArchive:aColOfFiles
1085
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   462
    self subclassResponsibility.
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   463
! !
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   464
1215
c3fe5597c1ec refactored
Claus Gittinger <cg@exept.de>
parents: 1205
diff changeset
   465
!Archiver methodsFor:'actions-basic'!
c3fe5597c1ec refactored
Claus Gittinger <cg@exept.de>
parents: 1205
diff changeset
   466
c3fe5597c1ec refactored
Claus Gittinger <cg@exept.de>
parents: 1205
diff changeset
   467
addFilesToArchive:colOfFiles
c3fe5597c1ec refactored
Claus Gittinger <cg@exept.de>
parents: 1205
diff changeset
   468
    self subclassResponsibility.
c3fe5597c1ec refactored
Claus Gittinger <cg@exept.de>
parents: 1205
diff changeset
   469
!
c3fe5597c1ec refactored
Claus Gittinger <cg@exept.de>
parents: 1205
diff changeset
   470
c3fe5597c1ec refactored
Claus Gittinger <cg@exept.de>
parents: 1205
diff changeset
   471
extractFiles:aColOfFilesOrNil to:aDirectory
c3fe5597c1ec refactored
Claus Gittinger <cg@exept.de>
parents: 1205
diff changeset
   472
    self subclassResponsibility.
c3fe5597c1ec refactored
Claus Gittinger <cg@exept.de>
parents: 1205
diff changeset
   473
! !
c3fe5597c1ec refactored
Claus Gittinger <cg@exept.de>
parents: 1205
diff changeset
   474
c3fe5597c1ec refactored
Claus Gittinger <cg@exept.de>
parents: 1205
diff changeset
   475
!Archiver methodsFor:'actions-private'!
1085
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   476
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   477
removeTemporaryDirectory
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   478
    temporaryDirectory notNil ifTrue:[
3490
a29c708667c9 class: Archiver
Stefan Vogel <sv@exept.de>
parents: 3471
diff changeset
   479
        self temporaryDirectory recursiveRemove.
1591
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
   480
        temporaryDirectory := nil.
1085
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   481
    ].
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   482
!
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   483
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   484
stopProcess
4244
66c023206027 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 4219
diff changeset
   485
    |p|
1085
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   486
4244
66c023206027 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 4219
diff changeset
   487
    p := process.
66c023206027 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 4219
diff changeset
   488
    p notNil ifTrue:[
66c023206027 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 4219
diff changeset
   489
        p terminateGroup.
66c023206027 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 4219
diff changeset
   490
        p waitUntilFinished.
66c023206027 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 4219
diff changeset
   491
        process := nil.
1085
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   492
    ].
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   493
! !
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   494
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   495
!Archiver methodsFor:'command execution'!
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   496
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   497
executeCommand:cmd directory:aDirectory
4244
66c023206027 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 4219
diff changeset
   498
    |osProcess|
66c023206027 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 4219
diff changeset
   499
2646
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
   500
    cmd isNil ifTrue:[
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
   501
        errorStream nextPutAll:'No command for archive operation.'.
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
   502
        ^ false
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
   503
    ].
5221
c485f62cfdc7 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 5070
diff changeset
   504
    osProcess := OSProcess new.
c485f62cfdc7 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 5070
diff changeset
   505
    osProcess command:cmd directory:aDirectory outStream:outStream errorStream:errorStream.
c485f62cfdc7 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 5070
diff changeset
   506
    osProcess lineWise:true.          "do it lineWise, since outStream may be an ActorStream"
1085
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   507
5368
17fbe26c92e3 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5221
diff changeset
   508
    synchronous isNil ifTrue:[synchronous := true].
17fbe26c92e3 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5221
diff changeset
   509
    synchronous ifTrue:[
4244
66c023206027 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 4219
diff changeset
   510
        ^ osProcess execute.
1085
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   511
    ] ifFalse:[
4244
66c023206027 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 4219
diff changeset
   512
        osProcess terminateActionBlock:[process := nil].
66c023206027 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 4219
diff changeset
   513
        process := osProcess.
66c023206027 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 4219
diff changeset
   514
        ^ osProcess startProcess.
1085
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   515
    ]
2646
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
   516
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
   517
    "Modified: / 16-09-2011 / 16:32:37 / cg"
1085
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   518
!
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   519
1246
1eefc3a60863 output parsing refactored;
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
   520
isValidOutputLine:line
1eefc3a60863 output parsing refactored;
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
   521
    "return true, if line contains a valid list-files output line"
1eefc3a60863 output parsing refactored;
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
   522
1eefc3a60863 output parsing refactored;
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
   523
    self subclassResponsibility
1eefc3a60863 output parsing refactored;
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
   524
!
1eefc3a60863 output parsing refactored;
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
   525
1eefc3a60863 output parsing refactored;
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
   526
listFilesReader
1eefc3a60863 output parsing refactored;
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
   527
    |reader|
1eefc3a60863 output parsing refactored;
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
   528
1eefc3a60863 output parsing refactored;
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
   529
    reader := ArchiverOutputParser new.
1eefc3a60863 output parsing refactored;
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
   530
    reader archiver:self.
1eefc3a60863 output parsing refactored;
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
   531
    ^ reader
1085
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   532
! !
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   533
1255
32e0aa97ae82 gzip archiver stuff fixed.
Claus Gittinger <cg@exept.de>
parents: 1247
diff changeset
   534
!Archiver methodsFor:'command strings'!
32e0aa97ae82 gzip archiver stuff fixed.
Claus Gittinger <cg@exept.de>
parents: 1247
diff changeset
   535
32e0aa97ae82 gzip archiver stuff fixed.
Claus Gittinger <cg@exept.de>
parents: 1247
diff changeset
   536
addDoubleQuotedFilenames:collectionOfFilenames toStream:aStream
32e0aa97ae82 gzip archiver stuff fixed.
Claus Gittinger <cg@exept.de>
parents: 1247
diff changeset
   537
    collectionOfFilenames notNil ifTrue:[
1591
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
   538
        collectionOfFilenames do:[:el | 
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
   539
            aStream nextPutAll:' "'.
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
   540
            aStream nextPutAll:(el asString).
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
   541
            aStream nextPutAll:'"'
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
   542
        ].
1255
32e0aa97ae82 gzip archiver stuff fixed.
Claus Gittinger <cg@exept.de>
parents: 1247
diff changeset
   543
    ].
32e0aa97ae82 gzip archiver stuff fixed.
Claus Gittinger <cg@exept.de>
parents: 1247
diff changeset
   544
! !
32e0aa97ae82 gzip archiver stuff fixed.
Claus Gittinger <cg@exept.de>
parents: 1247
diff changeset
   545
1085
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   546
!Archiver methodsFor:'initialization & release'!
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   547
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   548
release
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   549
    self stopProcess.
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   550
    self removeTemporaryDirectory.
3186
c2a5877276d8 class: Archiver
Claus Gittinger <cg@exept.de>
parents: 3027
diff changeset
   551
    super release
1085
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   552
! !
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   553
1383
527dcd29a97b added ar-archive (unix object-libraries)
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
   554
!Archiver::MultiFileArchive methodsFor:'actions'!
527dcd29a97b added ar-archive (unix object-libraries)
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
   555
527dcd29a97b added ar-archive (unix object-libraries)
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
   556
addFilesToArchive:colOfFiles
1798
74535804fe1b better error handling when zip command is not installed
boris
parents: 1795
diff changeset
   557
    |cmd tempDir archivFile archivInTemp fileSize backupFile result|
1383
527dcd29a97b added ar-archive (unix object-libraries)
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
   558
527dcd29a97b added ar-archive (unix object-libraries)
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
   559
    archivFile := self fileName.
527dcd29a97b added ar-archive (unix object-libraries)
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
   560
527dcd29a97b added ar-archive (unix object-libraries)
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
   561
    tempDir := self temporaryDirectory.
527dcd29a97b added ar-archive (unix object-libraries)
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
   562
    archivInTemp := tempDir construct:(archivFile baseName).
527dcd29a97b added ar-archive (unix object-libraries)
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
   563
1784
f90c4d7528c7 *** empty log message ***
boris
parents: 1783
diff changeset
   564
    "/ copy a non-empty archiv to tempDir
f90c4d7528c7 *** empty log message ***
boris
parents: 1783
diff changeset
   565
    fileSize := archivFile fileSize.
f90c4d7528c7 *** empty log message ***
boris
parents: 1783
diff changeset
   566
    (fileSize notNil and: [fileSize > 0])
f90c4d7528c7 *** empty log message ***
boris
parents: 1783
diff changeset
   567
      ifTrue: [archivFile copyTo:archivInTemp].
f90c4d7528c7 *** empty log message ***
boris
parents: 1783
diff changeset
   568
1383
527dcd29a97b added ar-archive (unix object-libraries)
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
   569
    "/ keep a save copy
1784
f90c4d7528c7 *** empty log message ***
boris
parents: 1783
diff changeset
   570
1799
5bb8bb7d430f creation of .sav file modified
boris
parents: 1798
diff changeset
   571
"/    backupFile := archivFile withSuffix: 'sav'.
5bb8bb7d430f creation of .sav file modified
boris
parents: 1798
diff changeset
   572
"/    (backupFile exists) ifTrue:[
5bb8bb7d430f creation of .sav file modified
boris
parents: 1798
diff changeset
   573
"/          backupFile recursiveRemove. " works for a file as well as for a directory " 
5bb8bb7d430f creation of .sav file modified
boris
parents: 1798
diff changeset
   574
"/    ].
1795
e52a638e2a81 deletion of an old *.sav file fixed
boris
parents: 1784
diff changeset
   575
1799
5bb8bb7d430f creation of .sav file modified
boris
parents: 1798
diff changeset
   576
"/    archivFile renameTo:(archivFile withSuffix:'sav').
1795
e52a638e2a81 deletion of an old *.sav file fixed
boris
parents: 1784
diff changeset
   577
1383
527dcd29a97b added ar-archive (unix object-libraries)
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
   578
    [
1591
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
   579
        "/ copy files to be added to tempDir
1784
f90c4d7528c7 *** empty log message ***
boris
parents: 1783
diff changeset
   580
        colOfFiles do:[:file | | destName |
f90c4d7528c7 *** empty log message ***
boris
parents: 1783
diff changeset
   581
            destName := tempDir construct:(file asFilename baseName).
f90c4d7528c7 *** empty log message ***
boris
parents: 1783
diff changeset
   582
            file isDirectory
f90c4d7528c7 *** empty log message ***
boris
parents: 1783
diff changeset
   583
              ifTrue: [destName := tempDir]. 
f90c4d7528c7 *** empty log message ***
boris
parents: 1783
diff changeset
   584
            file recursiveCopyTo:destName.
1591
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
   585
        ].
1383
527dcd29a97b added ar-archive (unix object-libraries)
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
   586
1798
74535804fe1b better error handling when zip command is not installed
boris
parents: 1795
diff changeset
   587
        "/ addFiles to the archive. Synchron command execution answers
74535804fe1b better error handling when zip command is not installed
boris
parents: 1795
diff changeset
   588
        "/ a boolean.
1591
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
   589
        cmd := self getCommandToAdd:colOfFiles toArchive:archivInTemp.
2646
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
   590
        cmd isNil ifTrue:[
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
   591
            errorStream nextPutAll:'No command to add files.'.
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
   592
            result := false
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
   593
        ] ifFalse:[
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
   594
            result := self executeCommand:cmd directory:tempDir.
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
   595
        ].
1383
527dcd29a97b added ar-archive (unix object-libraries)
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
   596
1798
74535804fe1b better error handling when zip command is not installed
boris
parents: 1795
diff changeset
   597
        "/ copy the archive back
74535804fe1b better error handling when zip command is not installed
boris
parents: 1795
diff changeset
   598
        (result == true and: [archivInTemp exists]) ifTrue:[
74535804fe1b better error handling when zip command is not installed
boris
parents: 1795
diff changeset
   599
            archivInTemp copyTo:archivFile.
74535804fe1b better error handling when zip command is not installed
boris
parents: 1795
diff changeset
   600
        ].
1383
527dcd29a97b added ar-archive (unix object-libraries)
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
   601
    ] ensure:[
1591
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
   602
        "/ cg: remove the tempFile
1798
74535804fe1b better error handling when zip command is not installed
boris
parents: 1795
diff changeset
   603
        archivInTemp exists ifTrue:[ archivInTemp remove.].
1591
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
   604
        "/ cg: remove copied files
1784
f90c4d7528c7 *** empty log message ***
boris
parents: 1783
diff changeset
   605
       " colOfFiles do:[:file |
1591
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
   606
            (tempDir construct:(file asFilename baseName)) remove.
1784
f90c4d7528c7 *** empty log message ***
boris
parents: 1783
diff changeset
   607
        ]. "
1783
c7c8d7faccc0 two fixes: creation of a new zip-file is now possible
boris
parents: 1591
diff changeset
   608
        "/ boris: remove the temporary directory and its name, too.
1784
f90c4d7528c7 *** empty log message ***
boris
parents: 1783
diff changeset
   609
        tempDir recursiveRemove.
1783
c7c8d7faccc0 two fixes: creation of a new zip-file is now possible
boris
parents: 1591
diff changeset
   610
        temporaryDirectory := nil.
1798
74535804fe1b better error handling when zip command is not installed
boris
parents: 1795
diff changeset
   611
    ].
1784
f90c4d7528c7 *** empty log message ***
boris
parents: 1783
diff changeset
   612
1798
74535804fe1b better error handling when zip command is not installed
boris
parents: 1795
diff changeset
   613
    ^result == true.
2646
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
   614
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
   615
    "Modified: / 16-09-2011 / 16:35:17 / cg"
1383
527dcd29a97b added ar-archive (unix object-libraries)
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
   616
!
527dcd29a97b added ar-archive (unix object-libraries)
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
   617
527dcd29a97b added ar-archive (unix object-libraries)
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
   618
extractFiles:aColOfFilesOrNil to:aDirectory
527dcd29a97b added ar-archive (unix object-libraries)
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
   619
    |execDir cmd|
527dcd29a97b added ar-archive (unix object-libraries)
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
   620
527dcd29a97b added ar-archive (unix object-libraries)
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
   621
    execDir := self fileName directory.
527dcd29a97b added ar-archive (unix object-libraries)
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
   622
    cmd := self getCommandToExtractFiles:aColOfFilesOrNil intoDirectory:aDirectory.
2646
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
   623
    cmd isNil ifTrue:[
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
   624
        errorStream nextPutAll:'No command to extract files.'.
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
   625
        ^ self.
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
   626
    ].
1383
527dcd29a97b added ar-archive (unix object-libraries)
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
   627
    self executeCommand:cmd directory:execDir.
2646
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
   628
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
   629
    "Modified: / 16-09-2011 / 16:35:34 / cg"
1383
527dcd29a97b added ar-archive (unix object-libraries)
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
   630
!
527dcd29a97b added ar-archive (unix object-libraries)
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
   631
527dcd29a97b added ar-archive (unix object-libraries)
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
   632
extractFiles:aColOfFiles withoutDirectoryTo:aDirectory
527dcd29a97b added ar-archive (unix object-libraries)
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
   633
    |execDir tempDir tempFile targetFile|
527dcd29a97b added ar-archive (unix object-libraries)
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
   634
527dcd29a97b added ar-archive (unix object-libraries)
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
   635
    execDir := self fileName directory.
527dcd29a97b added ar-archive (unix object-libraries)
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
   636
    tempDir := self temporaryDirectory.
527dcd29a97b added ar-archive (unix object-libraries)
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
   637
    self extractFiles:aColOfFiles to:tempDir.
527dcd29a97b added ar-archive (unix object-libraries)
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
   638
527dcd29a97b added ar-archive (unix object-libraries)
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
   639
    aColOfFiles do:[ : aFileString |
1591
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
   640
        tempFile := self temporaryDirectory construct:aFileString.
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
   641
        targetFile := aDirectory construct:(aFileString asFilename baseName).
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
   642
        targetFile exists ifTrue:[
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
   643
            targetFile recursiveRemove.
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
   644
        ].
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
   645
        tempFile exists ifTrue:[
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
   646
            tempFile recursiveCopyTo:targetFile.
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
   647
        ].
1383
527dcd29a97b added ar-archive (unix object-libraries)
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
   648
    ].
527dcd29a97b added ar-archive (unix object-libraries)
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
   649
!
527dcd29a97b added ar-archive (unix object-libraries)
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
   650
527dcd29a97b added ar-archive (unix object-libraries)
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
   651
removeFilesFromArchive:aColOfFiles
527dcd29a97b added ar-archive (unix object-libraries)
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
   652
527dcd29a97b added ar-archive (unix object-libraries)
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
   653
    |cmd|
527dcd29a97b added ar-archive (unix object-libraries)
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
   654
527dcd29a97b added ar-archive (unix object-libraries)
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
   655
    cmd := self getCommandToRemoveFiles:aColOfFiles.
2646
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
   656
    cmd isNil ifTrue:[
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
   657
        errorStream nextPutAll:'No command to remove files.'.
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
   658
        ^ self.
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
   659
    ].
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
   660
    self executeCommand:cmd directory:(self fileName directory).
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
   661
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
   662
    "Modified: / 16-09-2011 / 16:35:41 / cg"
1383
527dcd29a97b added ar-archive (unix object-libraries)
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
   663
! !
527dcd29a97b added ar-archive (unix object-libraries)
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
   664
527dcd29a97b added ar-archive (unix object-libraries)
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
   665
!Archiver::MultiFileArchive methodsFor:'command strings'!
527dcd29a97b added ar-archive (unix object-libraries)
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
   666
527dcd29a97b added ar-archive (unix object-libraries)
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
   667
getCommandToAdd:colOfFiles toArchive:archivIn
527dcd29a97b added ar-archive (unix object-libraries)
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
   668
    self subclassResponsibility
527dcd29a97b added ar-archive (unix object-libraries)
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
   669
!
527dcd29a97b added ar-archive (unix object-libraries)
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
   670
527dcd29a97b added ar-archive (unix object-libraries)
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
   671
getCommandToExtractFiles:sel intoDirectory:dir
527dcd29a97b added ar-archive (unix object-libraries)
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
   672
    self subclassResponsibility
527dcd29a97b added ar-archive (unix object-libraries)
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
   673
!
527dcd29a97b added ar-archive (unix object-libraries)
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
   674
527dcd29a97b added ar-archive (unix object-libraries)
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
   675
getCommandToListFiles:aColOfFiles
527dcd29a97b added ar-archive (unix object-libraries)
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
   676
    self subclassResponsibility
527dcd29a97b added ar-archive (unix object-libraries)
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
   677
!
527dcd29a97b added ar-archive (unix object-libraries)
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
   678
527dcd29a97b added ar-archive (unix object-libraries)
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
   679
getCommandToRemoveFiles:aColOfFiles
527dcd29a97b added ar-archive (unix object-libraries)
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
   680
    self subclassResponsibility
527dcd29a97b added ar-archive (unix object-libraries)
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
   681
! !
527dcd29a97b added ar-archive (unix object-libraries)
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
   682
1246
1eefc3a60863 output parsing refactored;
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
   683
!Archiver::ArchiverOutputParser class methodsFor:'instance creation'!
1eefc3a60863 output parsing refactored;
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
   684
1eefc3a60863 output parsing refactored;
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
   685
new
1eefc3a60863 output parsing refactored;
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
   686
    ^ self basicNew initialize.
1eefc3a60863 output parsing refactored;
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
   687
! !
1eefc3a60863 output parsing refactored;
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
   688
1eefc3a60863 output parsing refactored;
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
   689
!Archiver::ArchiverOutputParser methodsFor:'accessing'!
1eefc3a60863 output parsing refactored;
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
   690
1eefc3a60863 output parsing refactored;
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
   691
archiver:something
1eefc3a60863 output parsing refactored;
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
   692
    "set the value of the instance variable 'archiver' (automatically generated)"
1eefc3a60863 output parsing refactored;
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
   693
1eefc3a60863 output parsing refactored;
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
   694
    archiver := something.
1eefc3a60863 output parsing refactored;
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
   695
! !
1eefc3a60863 output parsing refactored;
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
   696
1eefc3a60863 output parsing refactored;
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
   697
!Archiver::ArchiverOutputParser methodsFor:'initialization'!
1086
2af5aca23dba zip added
penk
parents: 1085
diff changeset
   698
1246
1eefc3a60863 output parsing refactored;
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
   699
initialize
1eefc3a60863 output parsing refactored;
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
   700
    firstLineRead := false.
1eefc3a60863 output parsing refactored;
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
   701
! !
1eefc3a60863 output parsing refactored;
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
   702
1eefc3a60863 output parsing refactored;
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
   703
!Archiver::ArchiverOutputParser methodsFor:'parsing'!
1eefc3a60863 output parsing refactored;
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
   704
3436
349eb5e4cb79 class: Archiver
Claus Gittinger <cg@exept.de>
parents: 3222
diff changeset
   705
parseLine:lineIn forItemClass:itemClass
349eb5e4cb79 class: Archiver
Claus Gittinger <cg@exept.de>
parents: 3222
diff changeset
   706
    |words archiverColumns item index key line|
1246
1eefc3a60863 output parsing refactored;
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
   707
1eefc3a60863 output parsing refactored;
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
   708
    (firstLineRead not and:[archiver class hasTitleLine]) ifTrue:[
1591
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
   709
        firstLineRead := true.
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
   710
        ^ nil.
1246
1eefc3a60863 output parsing refactored;
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
   711
    ].
1eefc3a60863 output parsing refactored;
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
   712
3436
349eb5e4cb79 class: Archiver
Claus Gittinger <cg@exept.de>
parents: 3222
diff changeset
   713
    line := OperatingSystem decodePathOrCommandOutput:lineIn.
349eb5e4cb79 class: Archiver
Claus Gittinger <cg@exept.de>
parents: 3222
diff changeset
   714
1246
1eefc3a60863 output parsing refactored;
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
   715
    (archiver isValidOutputLine:line) ifFalse:[
1591
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
   716
        ^ nil.
1246
1eefc3a60863 output parsing refactored;
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
   717
    ].
1eefc3a60863 output parsing refactored;
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
   718
1eefc3a60863 output parsing refactored;
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
   719
    words := line asCollectionOfWords.
1eefc3a60863 output parsing refactored;
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
   720
    archiverColumns := archiver columns.
1eefc3a60863 output parsing refactored;
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
   721
    item := itemClass new.
1eefc3a60863 output parsing refactored;
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
   722
    index := 1.
1086
2af5aca23dba zip added
penk
parents: 1085
diff changeset
   723
1246
1eefc3a60863 output parsing refactored;
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
   724
    archiverColumns do:[:colDescr |
4315
d14a71b89af8 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4249
diff changeset
   725
        | itemWordCount itemStream itemFieldSelector |
1246
1eefc3a60863 output parsing refactored;
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
   726
1591
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
   727
        itemWordCount := colDescr second.
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
   728
        itemFieldSelector := colDescr first.
4315
d14a71b89af8 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4249
diff changeset
   729
1591
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
   730
        itemStream := WriteStream on:''.
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
   731
        itemWordCount == #rest ifTrue:[
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
   732
            words from:index do:[:w|
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
   733
                itemStream nextPutAll:w.
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
   734
                itemStream space.
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
   735
            ].
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
   736
        ] ifFalse:[
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
   737
            words from:index to:(index + itemWordCount - 1) do:[:w|
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
   738
                itemStream nextPutAll:w.
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
   739
                itemStream space.
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
   740
            ].
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
   741
            index := index + itemWordCount.
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
   742
        ].
4315
d14a71b89af8 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4249
diff changeset
   743
        itemFieldSelector notNil ifTrue:[
d14a71b89af8 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4249
diff changeset
   744
            |itemWriter|
d14a71b89af8 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4249
diff changeset
   745
d14a71b89af8 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4249
diff changeset
   746
            itemWriter := itemFieldSelector asMutator.
1591
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
   747
            item perform:itemWriter with:(itemStream contents withoutSeparators).
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
   748
        ].
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
   749
        itemStream close.
1246
1eefc3a60863 output parsing refactored;
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
   750
    ].
1eefc3a60863 output parsing refactored;
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
   751
    ((archiverColumns collect:[:el| el first]) includes:#permissions) ifTrue:[
1591
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
   752
        (item permissions startsWith:$d) ifTrue:[
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
   753
            key := #directory.
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
   754
            item isDirectory:true.
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
   755
        ] ifFalse:[
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
   756
            key := MIMETypes mimeTypeForFilename:(item fileName asFilename baseName).
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
   757
            item isDirectory:false.
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
   758
        ].
1246
1eefc3a60863 output parsing refactored;
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
   759
    ] ifFalse:[
1591
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
   760
        key := MIMETypes mimeTypeForFilename:(item fileName asFilename baseName).
1246
1eefc3a60863 output parsing refactored;
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
   761
    ].
3222
bb50c5b07f96 Do not refer to FileBrowser methods
Stefan Vogel <sv@exept.de>
parents: 3206
diff changeset
   762
    item icon:(MIMETypeIconLibrary iconForKeyMatching:key).
1246
1eefc3a60863 output parsing refactored;
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
   763
    ^ item
4315
d14a71b89af8 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4249
diff changeset
   764
d14a71b89af8 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4249
diff changeset
   765
    "Modified: / 10-02-2017 / 14:51:54 / cg"
1086
2af5aca23dba zip added
penk
parents: 1085
diff changeset
   766
! !
2af5aca23dba zip added
penk
parents: 1085
diff changeset
   767
1392
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   768
!Archiver::CompressedFile class methodsFor:'command strings'!
1215
c3fe5597c1ec refactored
Claus Gittinger <cg@exept.de>
parents: 1205
diff changeset
   769
1392
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   770
compressCommand
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   771
    self subclassResponsibility
1215
c3fe5597c1ec refactored
Claus Gittinger <cg@exept.de>
parents: 1205
diff changeset
   772
!
c3fe5597c1ec refactored
Claus Gittinger <cg@exept.de>
parents: 1205
diff changeset
   773
1392
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   774
uncompressCommand
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   775
    self subclassResponsibility
1215
c3fe5597c1ec refactored
Claus Gittinger <cg@exept.de>
parents: 1205
diff changeset
   776
! !
c3fe5597c1ec refactored
Claus Gittinger <cg@exept.de>
parents: 1205
diff changeset
   777
1392
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   778
!Archiver::CompressedFile class methodsFor:'queries'!
1086
2af5aca23dba zip added
penk
parents: 1085
diff changeset
   779
1106
893c2c508df1 checkin from browser
penk
parents: 1098
diff changeset
   780
canViewFile
893c2c508df1 checkin from browser
penk
parents: 1098
diff changeset
   781
893c2c508df1 checkin from browser
penk
parents: 1098
diff changeset
   782
    ^ true
1086
2af5aca23dba zip added
penk
parents: 1085
diff changeset
   783
! !
2af5aca23dba zip added
penk
parents: 1085
diff changeset
   784
1392
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   785
!Archiver::CompressedFile methodsFor:'actions'!
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   786
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   787
compressFile:aFile to:newFile
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   788
    | cmd directory|
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   789
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   790
    directory := newFile directory.
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   791
    (directory exists) ifFalse:[
2086
4ffc55b2f921 self warn
Claus Gittinger <cg@exept.de>
parents: 2040
diff changeset
   792
        self warn:'Cannot compress to non-existing directory ', directory asString.
1392
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   793
    ].
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   794
    (directory isDirectory) ifFalse:[
2086
4ffc55b2f921 self warn
Claus Gittinger <cg@exept.de>
parents: 2040
diff changeset
   795
        self warn:'Cannot compress to non-directory ', directory asString.
1392
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   796
    ].
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   797
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   798
    cmd := self getCommandToCompress:aFile asNew:newFile.
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   799
    self executeCommand:cmd directory:directory.
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   800
    newFile exists ifTrue:[
1591
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
   801
        self fileName:newFile.
1392
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   802
    ].
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   803
!
1085
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   804
1215
c3fe5597c1ec refactored
Claus Gittinger <cg@exept.de>
parents: 1205
diff changeset
   805
extractFiles:aColOfFilesOrNil to:aDirectory
1392
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   806
    self uncompressTo:aDirectory
1106
893c2c508df1 checkin from browser
penk
parents: 1098
diff changeset
   807
!
893c2c508df1 checkin from browser
penk
parents: 1098
diff changeset
   808
1392
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   809
uncompressTo:aDirectory
1085
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   810
    | cmd file newFile|
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   811
1392
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   812
    (aDirectory exists) ifFalse:[
2086
4ffc55b2f921 self warn
Claus Gittinger <cg@exept.de>
parents: 2040
diff changeset
   813
        self warn:'Cannot uncompress to non-existing directory ', aDirectory asString.
1591
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
   814
        ^ self
1085
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   815
    ].
1392
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   816
    (aDirectory isDirectory) ifFalse:[
2086
4ffc55b2f921 self warn
Claus Gittinger <cg@exept.de>
parents: 2040
diff changeset
   817
        self warn:'Cannot uncompress to file ', aDirectory asString.
1591
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
   818
        ^ self
1085
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   819
    ].
1215
c3fe5597c1ec refactored
Claus Gittinger <cg@exept.de>
parents: 1205
diff changeset
   820
    file := newFile := self fileName.
c3fe5597c1ec refactored
Claus Gittinger <cg@exept.de>
parents: 1205
diff changeset
   821
    (file directory pathName = aDirectory pathName) ifFalse:[
1591
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
   822
        newFile := aDirectory construct:(file baseName).
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
   823
        file copyTo:newFile.
1085
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   824
    ].
1392
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   825
    cmd := self getCommandToUncompress:newFile.
1591
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
   826
    self executeCommand:cmd directory:aDirectory. 
1392
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   827
! !
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   828
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   829
!Archiver::CompressedFile methodsFor:'columns'!
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   830
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   831
columns
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   832
    self subclassResponsibility
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   833
!
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   834
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   835
isValidOutputLine:line
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   836
    ^ line endsWith:self fileName withoutSuffix baseName.
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   837
! !
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   838
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   839
!Archiver::CompressedFile methodsFor:'command strings'!
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   840
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   841
getCommandToCompress:aFile asNew:newFile
1591
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
   842
    ^ '%1 -c %2 > %3' 
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
   843
        bindWith:self class compressCommand
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
   844
        with:aFile asString 
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
   845
        with:newFile asString
1392
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   846
!
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   847
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   848
getCommandToListFiles:dummyArg
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   849
    ^ 'gzip -l "' , self fileName baseName , '"'
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   850
!
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   851
1591
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
   852
getCommandToUncompress:aFileName 
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
   853
    ^ '%1 %2' 
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
   854
        bindWith:self class uncompressCommand
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
   855
        with:aFileName baseName
1392
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   856
! !
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   857
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   858
!Archiver::BZ2Compressed class methodsFor:'command strings'!
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   859
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   860
compressCommand
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   861
    ^ 'bzip2'
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   862
!
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   863
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   864
uncompressCommand
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   865
    ^ 'bunzip2'
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   866
! !
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   867
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   868
!Archiver::BZ2Compressed methodsFor:'columns'!
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   869
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   870
columns
1591
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
   871
    ^ #(      
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
   872
         #(#fileName        1)
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
   873
    ) 
1392
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   874
!
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   875
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   876
isValidOutputLine:line
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   877
    ^ true
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   878
! !
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   879
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   880
!Archiver::BZ2Compressed methodsFor:'command strings'!
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   881
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   882
getCommandToListFiles:dummyArg
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   883
    ^ 'echo ' , self fileName withoutSuffix baseName
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   884
"/    ^ 'bzip2 -t -v "' , self fileName baseName , '"'
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   885
! !
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   886
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   887
!Archiver::CompressedTarArchive class methodsFor:'queries'!
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   888
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   889
canAddFiles
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   890
    ^ Archiver tarArchive canAddFiles
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   891
!
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   892
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   893
canRemoveFiles
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   894
    ^ Archiver tarArchive canRemoveFiles
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   895
!
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   896
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   897
canViewFile
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   898
    ^ Archiver tarArchive canViewFile
1085
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   899
!
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   900
1392
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   901
compressorClass
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   902
    self subclassResponsibility
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   903
! !
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   904
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   905
!Archiver::CompressedTarArchive methodsFor:'accessing'!
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   906
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   907
fileName:aFile
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   908
    |tempDir file compressor suffix tarFilename|
1085
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   909
1392
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   910
    super fileName:aFile.
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   911
    " unzip file in tempDirectory and do all the things with tar file "
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   912
    tempDir := self temporaryDirectory.
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   913
    compressor := (self class compressorClass) with:(self fileName).
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   914
    compressor uncompressTo:tempDir.
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   915
    suffix := self fileName suffix.
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   916
    file := self fileName withoutSuffix.
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   917
    tarFilename := file baseName.
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   918
    file suffix ~= 'tar' ifTrue:[
1591
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
   919
        tarFilename := tarFilename , '.tar'
1085
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   920
    ].
1392
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   921
    tarFile := self temporaryDirectory construct:tarFilename.
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   922
    tarArchiver := Archiver::TarArchive with:tarFile.
1085
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   923
! !
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   924
1392
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   925
!Archiver::CompressedTarArchive methodsFor:'actions'!
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   926
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   927
addFilesToArchive:colOfFiles
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   928
    self setCommandOptions.
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   929
    tarArchiver addFilesToArchive:colOfFiles.
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   930
    "/ synchronize the tar archive under temporary file with archiv file position
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   931
    self synchronize.
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   932
!
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   933
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   934
extractFiles:aColOfFiles to:aDirectory
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   935
    self setCommandOptions.
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   936
    tarArchiver extractFiles:aColOfFiles to:aDirectory.
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   937
!
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   938
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   939
extractFiles:aColOfFiles withoutDirectoryTo:aDirectory
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   940
    self setCommandOptions.
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   941
    tarArchiver extractFiles:aColOfFiles withoutDirectoryTo:aDirectory.
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   942
!
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   943
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   944
listFiles:aColOfFiles
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   945
    self setCommandOptions.
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   946
    tarArchiver listFiles:aColOfFiles.
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   947
!
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   948
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   949
removeFilesFromArchive:aColOfFiles
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   950
    self setCommandOptions.
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   951
    tarArchiver removeFilesFromArchive:aColOfFiles.
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   952
    self synchronize.
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   953
! !
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   954
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   955
!Archiver::CompressedTarArchive methodsFor:'actions private'!
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   956
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   957
setCommandOptions
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   958
    tarArchiver outStream:(self outStream).
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   959
    tarArchiver errorStream:(self errorStream).
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   960
    tarArchiver synchron:(self synchron).
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   961
!
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   962
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   963
synchronize
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   964
    self subclassResponsibility
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   965
! !
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   966
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   967
!Archiver::CompressedTarArchive methodsFor:'columns'!
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   968
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   969
columns
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   970
    ^ tarArchiver columns
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   971
!
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   972
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   973
isValidOutputLine:line
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   974
    ^ tarArchiver isValidOutputLine:line
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   975
! !
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   976
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   977
!Archiver::CompressedTarArchive methodsFor:'initialization & release'!
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   978
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   979
release
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   980
    super release.
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   981
    tarArchiver release.
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   982
! !
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   983
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   984
!Archiver::GZipCompressed class methodsFor:'command strings'!
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   985
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   986
compressCommand
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   987
    ^ 'gzip'
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   988
!
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   989
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   990
uncompressCommand
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   991
    ^ 'gunzip'
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   992
! !
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   993
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   994
!Archiver::GZipCompressed class methodsFor:'queries'!
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   995
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   996
hasTitleLine
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   997
    ^ true
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   998
! !
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   999
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
  1000
!Archiver::GZipCompressed methodsFor:'columns'!
1246
1eefc3a60863 output parsing refactored;
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
  1001
1eefc3a60863 output parsing refactored;
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
  1002
columns
1eefc3a60863 output parsing refactored;
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
  1003
1eefc3a60863 output parsing refactored;
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
  1004
    "/ columns in stream order
1247
4c628a0455c1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1246
diff changeset
  1005
    "/  colums id/readSelector          words to read
1591
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
  1006
    ^ #( "/ #(#method          1)      
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
  1007
         "/ #(#crc             1)    
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
  1008
         "/ #(#dateAndTime     3)   
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
  1009
         #(#compressSize    1)  
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
  1010
         #(#size            1) 
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
  1011
         #(#ratio           1) 
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
  1012
         #(#fileName        #rest)
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
  1013
    ) 
1255
32e0aa97ae82 gzip archiver stuff fixed.
Claus Gittinger <cg@exept.de>
parents: 1247
diff changeset
  1014
!
32e0aa97ae82 gzip archiver stuff fixed.
Claus Gittinger <cg@exept.de>
parents: 1247
diff changeset
  1015
32e0aa97ae82 gzip archiver stuff fixed.
Claus Gittinger <cg@exept.de>
parents: 1247
diff changeset
  1016
isValidOutputLine:line
32e0aa97ae82 gzip archiver stuff fixed.
Claus Gittinger <cg@exept.de>
parents: 1247
diff changeset
  1017
    ^ line endsWith:self fileName withoutSuffix baseName.
1246
1eefc3a60863 output parsing refactored;
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
  1018
! !
1eefc3a60863 output parsing refactored;
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
  1019
1392
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
  1020
!Archiver::GZipCompressed methodsFor:'command strings'!
1255
32e0aa97ae82 gzip archiver stuff fixed.
Claus Gittinger <cg@exept.de>
parents: 1247
diff changeset
  1021
32e0aa97ae82 gzip archiver stuff fixed.
Claus Gittinger <cg@exept.de>
parents: 1247
diff changeset
  1022
getCommandToListFiles:dummyArg
32e0aa97ae82 gzip archiver stuff fixed.
Claus Gittinger <cg@exept.de>
parents: 1247
diff changeset
  1023
    ^ 'gzip -l "' , self fileName baseName , '"'
1215
c3fe5597c1ec refactored
Claus Gittinger <cg@exept.de>
parents: 1205
diff changeset
  1024
! !
c3fe5597c1ec refactored
Claus Gittinger <cg@exept.de>
parents: 1205
diff changeset
  1025
4584
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1026
!Archiver::LZipArchive class methodsFor:'command strings'!
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1027
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1028
unzipCommand
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1029
    ^ 'lzip'
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1030
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1031
    "
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1032
     self unzipCommand    
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1033
    "
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1034
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1035
    "Modified: / 16-09-2011 / 17:26:18 / cg"
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1036
!
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1037
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1038
zipCommand
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1039
    ^ self unzipCommand.
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1040
! !
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1041
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1042
!Archiver::LZipArchive class methodsFor:'queries'!
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1043
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1044
canAddFiles
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1045
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1046
    ^ true
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1047
!
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1048
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1049
canRemoveFiles
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1050
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1051
    ^ true
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1052
!
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1053
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1054
canViewFile
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1055
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1056
    ^ true
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1057
!
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1058
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1059
hasLastLine
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1060
    ^ true
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1061
!
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1062
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1063
hasTitleLine
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1064
    ^ true
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1065
! !
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1066
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1067
!Archiver::LZipArchive methodsFor:'columns'!
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1068
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1069
columns
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1070
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1071
    "/  colums id/readSelector    words to read
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1072
    ^ #( (#uncompressed    2)      
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1073
         (#memb            1)    
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1074
         (#trail           1)     
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1075
         (#uncompressed    1)    
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1076
         (#compressed      1)    
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1077
         (saved            1)  
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1078
         (#fileName        #rest)
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1079
    ) 
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1080
!
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1081
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1082
isValidOutputLine:line
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1083
    ^ true.
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1084
! !
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1085
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1086
!Archiver::LZipArchive methodsFor:'command strings'!
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1087
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1088
getCommandToExtractFiles:aColOfFiles intoDirectory:dir
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1089
    |cmd template|
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1090
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1091
    cmd := self class unzipCommand.
4637
1d8bc0d9423a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4584
diff changeset
  1092
4584
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1093
    OperatingSystem isUNIXlike ifTrue:[
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1094
        template := '%1 -o -d "%2" "%3"'
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1095
    ].
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1096
    OperatingSystem isMSDOSlike ifTrue:[
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1097
        self halt:'unhandled os'.
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1098
    ].
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1099
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1100
    template notNil ifTrue:[
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1101
        ^ String streamContents:[:s |
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1102
            "/ -o   UnzipOverwriteExistingFilesOption
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1103
            "/ -d   UnzipExtDirectoryOption
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1104
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1105
            s nextPutAll:(template 
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1106
                    bindWith:cmd
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1107
                    with:dir asString string
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1108
                    with:self fileName asString).
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1109
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1110
            self addDoubleQuotedFilenames:aColOfFiles toStream:s.
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1111
        ]
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1112
    ].
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1113
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1114
    ^ nil.
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1115
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1116
    "Modified: / 16-09-2011 / 16:38:57 / cg"
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1117
!
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1118
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1119
getCommandToListFiles:aColOfFiles 
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1120
    |cmd template|
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1121
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1122
    cmd := self class unzipCommand.
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1123
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1124
    OperatingSystem isUNIXlike ifTrue:[
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1125
        "/  -l      list
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1126
        template := '"%1" -l "%2"'
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1127
    ].
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1128
    OperatingSystem isMSDOSlike ifTrue:[
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1129
        self error:'unsupported'
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1130
    ].
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1131
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1132
    template notNil ifTrue:[
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1133
        ^ String streamContents:[:s |
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1134
            s nextPutAll:(template 
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1135
                            bindWith:cmd with:self fileName asString string).
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1136
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1137
            aColOfFiles notNil ifTrue:[       
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1138
                self breakPoint:#ca.
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1139
                self 
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1140
                    addDoubleQuotedFilenames:(aColOfFiles collect:[:each | each asFilename baseName])
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1141
                    toStream:s.
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1142
            ].
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1143
        ].
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1144
    ].
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1145
    ^ nil.
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1146
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1147
    "Modified: / 29-11-2011 / 20:19:18 / cg"
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1148
!
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1149
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1150
getCommandToRemoveFiles:aColOfFiles 
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1151
    ^ nil.
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1152
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1153
    "Modified: / 16-09-2011 / 16:29:09 / cg"
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1154
! !
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1155
1383
527dcd29a97b added ar-archive (unix object-libraries)
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
  1156
!Archiver::ArArchive class methodsFor:'command strings'!
1215
c3fe5597c1ec refactored
Claus Gittinger <cg@exept.de>
parents: 1205
diff changeset
  1157
1383
527dcd29a97b added ar-archive (unix object-libraries)
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
  1158
arCommand
527dcd29a97b added ar-archive (unix object-libraries)
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
  1159
    ^ 'ar'
527dcd29a97b added ar-archive (unix object-libraries)
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
  1160
! !
527dcd29a97b added ar-archive (unix object-libraries)
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
  1161
527dcd29a97b added ar-archive (unix object-libraries)
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
  1162
!Archiver::ArArchive methodsFor:'columns'!
1215
c3fe5597c1ec refactored
Claus Gittinger <cg@exept.de>
parents: 1205
diff changeset
  1163
1383
527dcd29a97b added ar-archive (unix object-libraries)
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
  1164
columns
527dcd29a97b added ar-archive (unix object-libraries)
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
  1165
    "/  colums id/readSelector words to read
1591
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
  1166
    ^ #( 
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
  1167
         #(#permissions     1)      
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
  1168
         #(#ownerGroup      1)    
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
  1169
         #(#size            1)   
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
  1170
         #(#monthName       1)  
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
  1171
         #(#dayString       1)  
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
  1172
         #(#timeString      1)  
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
  1173
         #(#yearString      1)  
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
  1174
         #(#fileName        #rest)
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
  1175
    ) 
1085
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
  1176
!
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
  1177
1383
527dcd29a97b added ar-archive (unix object-libraries)
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
  1178
isValidOutputLine:line
527dcd29a97b added ar-archive (unix object-libraries)
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
  1179
    ('[-r][-w][-x]' match:(line copyTo:3)) ifTrue:[^ true].
527dcd29a97b added ar-archive (unix object-libraries)
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
  1180
    ^ false.
527dcd29a97b added ar-archive (unix object-libraries)
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
  1181
! !
1215
c3fe5597c1ec refactored
Claus Gittinger <cg@exept.de>
parents: 1205
diff changeset
  1182
1383
527dcd29a97b added ar-archive (unix object-libraries)
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
  1183
!Archiver::ArArchive methodsFor:'command strings'!
527dcd29a97b added ar-archive (unix object-libraries)
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
  1184
1591
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
  1185
getCommandToExtractFiles:sel intoDirectory:dir 
1383
527dcd29a97b added ar-archive (unix object-libraries)
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
  1186
    |stream|
1215
c3fe5597c1ec refactored
Claus Gittinger <cg@exept.de>
parents: 1205
diff changeset
  1187
1383
527dcd29a97b added ar-archive (unix object-libraries)
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
  1188
    stream := WriteStream on:''.
527dcd29a97b added ar-archive (unix object-libraries)
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
  1189
527dcd29a97b added ar-archive (unix object-libraries)
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
  1190
    "/ 'x'  arArchivUnpackOption
1591
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
  1191
    stream nextPutAll:('(cd %3 ; %1 x "%2" ' 
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
  1192
                    bindWith:self class arCommand
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
  1193
                    with:self fileName asString string
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
  1194
                    with:dir asString string).
1383
527dcd29a97b added ar-archive (unix object-libraries)
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
  1195
527dcd29a97b added ar-archive (unix object-libraries)
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
  1196
    sel notNil ifTrue:[
1591
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
  1197
        sel do:[:el | 
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
  1198
            stream nextPutAll:' "'.
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
  1199
            stream nextPutAll:(el asString).
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
  1200
            stream nextPutAll:'"'
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
  1201
        ].
1215
c3fe5597c1ec refactored
Claus Gittinger <cg@exept.de>
parents: 1205
diff changeset
  1202
    ].
1384
fea5bf58e5fb allow single extract from an archive
Claus Gittinger <cg@exept.de>
parents: 1383
diff changeset
  1203
    stream nextPutAll:')'.
1383
527dcd29a97b added ar-archive (unix object-libraries)
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
  1204
    ^ stream contents.
1085
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
  1205
!
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
  1206
1591
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
  1207
getCommandToListFiles:aColOfFiles 
1383
527dcd29a97b added ar-archive (unix object-libraries)
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
  1208
    |stream|
1215
c3fe5597c1ec refactored
Claus Gittinger <cg@exept.de>
parents: 1205
diff changeset
  1209
1383
527dcd29a97b added ar-archive (unix object-libraries)
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
  1210
    stream := WriteStream on:''.
1215
c3fe5597c1ec refactored
Claus Gittinger <cg@exept.de>
parents: 1205
diff changeset
  1211
1383
527dcd29a97b added ar-archive (unix object-libraries)
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
  1212
    "/ 't'  arArchivListContentsOption
527dcd29a97b added ar-archive (unix object-libraries)
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
  1213
    "/ 'v'  arArchivVerboseOption
1591
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
  1214
    stream nextPutAll:('%1 tv "%2"' 
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
  1215
                    bindWith:self class arCommand
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
  1216
                    with:self fileName baseName).
1215
c3fe5597c1ec refactored
Claus Gittinger <cg@exept.de>
parents: 1205
diff changeset
  1217
1383
527dcd29a97b added ar-archive (unix object-libraries)
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
  1218
    stream nextPutAll:(self class stringWithQuotedFileBaseNames:aColOfFiles).
527dcd29a97b added ar-archive (unix object-libraries)
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
  1219
    ^ stream contents.
1085
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
  1220
! !
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
  1221
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
  1222
!Archiver::TarArchive class methodsFor:'command strings'!
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
  1223
1215
c3fe5597c1ec refactored
Claus Gittinger <cg@exept.de>
parents: 1205
diff changeset
  1224
tarCommand
1085
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
  1225
    ^ 'tar'
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
  1226
! !
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
  1227
1086
2af5aca23dba zip added
penk
parents: 1085
diff changeset
  1228
!Archiver::TarArchive class methodsFor:'queries'!
2af5aca23dba zip added
penk
parents: 1085
diff changeset
  1229
2af5aca23dba zip added
penk
parents: 1085
diff changeset
  1230
canAddFiles
2af5aca23dba zip added
penk
parents: 1085
diff changeset
  1231
2af5aca23dba zip added
penk
parents: 1085
diff changeset
  1232
    ^ true
2af5aca23dba zip added
penk
parents: 1085
diff changeset
  1233
!
2af5aca23dba zip added
penk
parents: 1085
diff changeset
  1234
2af5aca23dba zip added
penk
parents: 1085
diff changeset
  1235
canRemoveFiles
2af5aca23dba zip added
penk
parents: 1085
diff changeset
  1236
2af5aca23dba zip added
penk
parents: 1085
diff changeset
  1237
    ^ true
1106
893c2c508df1 checkin from browser
penk
parents: 1098
diff changeset
  1238
!
893c2c508df1 checkin from browser
penk
parents: 1098
diff changeset
  1239
893c2c508df1 checkin from browser
penk
parents: 1098
diff changeset
  1240
canViewFile
893c2c508df1 checkin from browser
penk
parents: 1098
diff changeset
  1241
893c2c508df1 checkin from browser
penk
parents: 1098
diff changeset
  1242
    ^ true
1086
2af5aca23dba zip added
penk
parents: 1085
diff changeset
  1243
! !
2af5aca23dba zip added
penk
parents: 1085
diff changeset
  1244
1246
1eefc3a60863 output parsing refactored;
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
  1245
!Archiver::TarArchive methodsFor:'columns'!
1eefc3a60863 output parsing refactored;
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
  1246
1eefc3a60863 output parsing refactored;
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
  1247
columns
4794
d0ed3fa4a8c5 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4771
diff changeset
  1248
    "/  colums id/readSelector words to read
1246
1eefc3a60863 output parsing refactored;
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
  1249
4794
d0ed3fa4a8c5 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4771
diff changeset
  1250
    OperatingSystem isOSXlike ifTrue:[
d0ed3fa4a8c5 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4771
diff changeset
  1251
        ^ #( 
d0ed3fa4a8c5 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4771
diff changeset
  1252
             #(#permissions     1)      
d0ed3fa4a8c5 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4771
diff changeset
  1253
             #(#ownerGroup      3)    
d0ed3fa4a8c5 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4771
diff changeset
  1254
             #(#size            1)   
d0ed3fa4a8c5 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4771
diff changeset
  1255
             #(#dateAndTime     3)  
d0ed3fa4a8c5 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4771
diff changeset
  1256
             #(#fileName        #rest)
d0ed3fa4a8c5 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4771
diff changeset
  1257
        ) 
d0ed3fa4a8c5 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4771
diff changeset
  1258
    ].
d0ed3fa4a8c5 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4771
diff changeset
  1259
    
1591
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
  1260
    ^ #( #(#permissions     1)      
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
  1261
         #(#ownerGroup      1)    
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
  1262
         #(#size            1)   
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
  1263
         #(#dateAndTime     2)  
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
  1264
         #(#fileName        #rest)
4794
d0ed3fa4a8c5 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4771
diff changeset
  1265
    )
d0ed3fa4a8c5 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4771
diff changeset
  1266
d0ed3fa4a8c5 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4771
diff changeset
  1267
    "Modified: / 05-02-2019 / 10:37:41 / Claus Gittinger"
1246
1eefc3a60863 output parsing refactored;
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
  1268
!
1eefc3a60863 output parsing refactored;
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
  1269
1eefc3a60863 output parsing refactored;
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
  1270
isValidOutputLine:line
1eefc3a60863 output parsing refactored;
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
  1271
    ('[-d][-r][-w][-x]' match:(line copyTo:4)) ifTrue:[^ true].
1eefc3a60863 output parsing refactored;
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
  1272
    ^ false.
1eefc3a60863 output parsing refactored;
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
  1273
! !
1eefc3a60863 output parsing refactored;
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
  1274
1085
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
  1275
!Archiver::TarArchive methodsFor:'command strings'!
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
  1276
1215
c3fe5597c1ec refactored
Claus Gittinger <cg@exept.de>
parents: 1205
diff changeset
  1277
getCommandToAdd:aColOfFiles toArchive:archiveFile
1174
fde4f57dce18 cleanup
Claus Gittinger <cg@exept.de>
parents: 1145
diff changeset
  1278
    |stream|
1085
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
  1279
1215
c3fe5597c1ec refactored
Claus Gittinger <cg@exept.de>
parents: 1205
diff changeset
  1280
    archiveFile exists ifFalse:[^ nil].
1174
fde4f57dce18 cleanup
Claus Gittinger <cg@exept.de>
parents: 1145
diff changeset
  1281
fde4f57dce18 cleanup
Claus Gittinger <cg@exept.de>
parents: 1145
diff changeset
  1282
    stream := WriteStream on:''.
1145
9a6688b7139a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
  1283
1174
fde4f57dce18 cleanup
Claus Gittinger <cg@exept.de>
parents: 1145
diff changeset
  1284
    "/ 'r'  TarArchivAddOption
fde4f57dce18 cleanup
Claus Gittinger <cg@exept.de>
parents: 1145
diff changeset
  1285
    "/ 'f'  TarArchivFileOption
1591
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
  1286
    stream nextPutAll:('%1 rf "%2"' 
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
  1287
                    bindWith:self class tarCommand
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
  1288
                    with:archiveFile asString string).
1145
9a6688b7139a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
  1289
1174
fde4f57dce18 cleanup
Claus Gittinger <cg@exept.de>
parents: 1145
diff changeset
  1290
    stream nextPutAll:(self class stringWithQuotedFileBaseNames:aColOfFiles).
fde4f57dce18 cleanup
Claus Gittinger <cg@exept.de>
parents: 1145
diff changeset
  1291
    ^ stream contents
1085
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
  1292
!
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
  1293
1591
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
  1294
getCommandToExtractFiles:sel intoDirectory:dir 
1174
fde4f57dce18 cleanup
Claus Gittinger <cg@exept.de>
parents: 1145
diff changeset
  1295
    |stream|
1085
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
  1296
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
  1297
    stream := WriteStream on:''.
1145
9a6688b7139a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
  1298
9a6688b7139a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
  1299
    "/ 'x'  TarArchivUnpackOption
9a6688b7139a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
  1300
    "/ 'f'  TarArchivFileOption
9a6688b7139a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
  1301
    "/ 'C'  TarArchivUnpackInDirectoryOption
4249
d70b0b1791a7 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4244
diff changeset
  1302
    stream nextPutAll:('%1 -xf "%2" -C "%3"' 
1591
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
  1303
                    bindWith:self class tarCommand
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
  1304
                    with:self fileName asString string
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
  1305
                    with:dir asString).
1145
9a6688b7139a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
  1306
1085
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
  1307
    sel notNil ifTrue:[
1591
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
  1308
        sel do:[:el | 
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
  1309
            stream nextPutAll:' "'.
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
  1310
            stream nextPutAll:(el asString).
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
  1311
            stream nextPutAll:'"'
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
  1312
        ].
1085
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
  1313
    ].
1145
9a6688b7139a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
  1314
    ^ stream contents.
1085
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
  1315
!
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
  1316
1591
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
  1317
getCommandToListFiles:aColOfFiles 
1174
fde4f57dce18 cleanup
Claus Gittinger <cg@exept.de>
parents: 1145
diff changeset
  1318
    |stream|
1085
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
  1319
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
  1320
    stream := WriteStream on:''.
1145
9a6688b7139a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
  1321
9a6688b7139a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
  1322
    "/ 't'  TarArchivListContentsOption
9a6688b7139a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
  1323
    "/ 'v'  TarArchivVerboseOption
9a6688b7139a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
  1324
    "/ 'f'  TarArchivFileOption
1591
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
  1325
    stream nextPutAll:('%1 -tvf "%2"' 
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
  1326
                    bindWith:self class tarCommand
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
  1327
                    with:self fileName baseName).
1145
9a6688b7139a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
  1328
1174
fde4f57dce18 cleanup
Claus Gittinger <cg@exept.de>
parents: 1145
diff changeset
  1329
    stream nextPutAll:(self class stringWithQuotedFileBaseNames:aColOfFiles).
1145
9a6688b7139a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
  1330
    ^ stream contents.
1085
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
  1331
!
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
  1332
1591
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
  1333
getCommandToRemoveFiles:sel 
1174
fde4f57dce18 cleanup
Claus Gittinger <cg@exept.de>
parents: 1145
diff changeset
  1334
    |stream filename|
1085
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
  1335
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
  1336
    filename := self fileName.
1174
fde4f57dce18 cleanup
Claus Gittinger <cg@exept.de>
parents: 1145
diff changeset
  1337
    filename exists ifFalse:[^ nil].
1145
9a6688b7139a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
  1338
1174
fde4f57dce18 cleanup
Claus Gittinger <cg@exept.de>
parents: 1145
diff changeset
  1339
    stream := WriteStream on:''.
1145
9a6688b7139a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
  1340
1174
fde4f57dce18 cleanup
Claus Gittinger <cg@exept.de>
parents: 1145
diff changeset
  1341
    "/ 'f'  TarArchivFileOption
1591
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
  1342
    stream nextPutAll:('%1 --delete -f "%2"' 
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
  1343
                    bindWith:self class tarCommand
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
  1344
                    with:self fileName baseName).
1174
fde4f57dce18 cleanup
Claus Gittinger <cg@exept.de>
parents: 1145
diff changeset
  1345
fde4f57dce18 cleanup
Claus Gittinger <cg@exept.de>
parents: 1145
diff changeset
  1346
    stream nextPutAll:(self class stringWithQuotedFileBaseNames:sel).
fde4f57dce18 cleanup
Claus Gittinger <cg@exept.de>
parents: 1145
diff changeset
  1347
    ^ stream contents
1085
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
  1348
! !
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
  1349
1392
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
  1350
!Archiver::TarBZ2Archive class methodsFor:'queries'!
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
  1351
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
  1352
canAddFiles
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
  1353
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
  1354
    ^ Archiver tarArchive canAddFiles
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
  1355
!
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
  1356
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
  1357
canRemoveFiles
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
  1358
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
  1359
    ^ Archiver tarArchive canRemoveFiles
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
  1360
!
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
  1361
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
  1362
canViewFile
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
  1363
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
  1364
    ^ Archiver tarArchive canViewFile
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
  1365
!
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
  1366
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
  1367
compressorClass
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
  1368
    ^ Archiver::BZ2Compressed
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
  1369
! !
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
  1370
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
  1371
!Archiver::TarBZ2Archive methodsFor:'actions private'!
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
  1372
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
  1373
synchronize
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
  1374
    |gzipArchiver|
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
  1375
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
  1376
    gzipArchiver := Archiver::BZ2Compressed with:nil.
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
  1377
    gzipArchiver compressFile:(tarArchiver fileName) to:(self fileName).
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
  1378
! !
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
  1379
1086
2af5aca23dba zip added
penk
parents: 1085
diff changeset
  1380
!Archiver::TarGZipArchive class methodsFor:'queries'!
2af5aca23dba zip added
penk
parents: 1085
diff changeset
  1381
2af5aca23dba zip added
penk
parents: 1085
diff changeset
  1382
canAddFiles
2af5aca23dba zip added
penk
parents: 1085
diff changeset
  1383
2af5aca23dba zip added
penk
parents: 1085
diff changeset
  1384
    ^ Archiver tarArchive canAddFiles
2af5aca23dba zip added
penk
parents: 1085
diff changeset
  1385
!
2af5aca23dba zip added
penk
parents: 1085
diff changeset
  1386
2af5aca23dba zip added
penk
parents: 1085
diff changeset
  1387
canRemoveFiles
2af5aca23dba zip added
penk
parents: 1085
diff changeset
  1388
2af5aca23dba zip added
penk
parents: 1085
diff changeset
  1389
    ^ Archiver tarArchive canRemoveFiles
1106
893c2c508df1 checkin from browser
penk
parents: 1098
diff changeset
  1390
!
893c2c508df1 checkin from browser
penk
parents: 1098
diff changeset
  1391
893c2c508df1 checkin from browser
penk
parents: 1098
diff changeset
  1392
canViewFile
893c2c508df1 checkin from browser
penk
parents: 1098
diff changeset
  1393
893c2c508df1 checkin from browser
penk
parents: 1098
diff changeset
  1394
    ^ Archiver tarArchive canViewFile
1085
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
  1395
!
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
  1396
1392
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
  1397
compressorClass
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
  1398
    ^ Archiver::GZipCompressed
1085
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
  1399
! !
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
  1400
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
  1401
!Archiver::TarGZipArchive methodsFor:'actions private'!
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
  1402
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
  1403
synchronize
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
  1404
    |gzipArchiver|
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
  1405
1392
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
  1406
    gzipArchiver := Archiver::GZipCompressed with:nil.
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
  1407
    gzipArchiver compressFile:(tarArchiver fileName) to:(self fileName).
1085
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
  1408
! !
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
  1409
4103
d2f19ff163dc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
  1410
!Archiver::XarArchive class methodsFor:'command strings'!
d2f19ff163dc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
  1411
d2f19ff163dc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
  1412
xarCommand
d2f19ff163dc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
  1413
    ^ 'xar'
d2f19ff163dc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
  1414
! !
d2f19ff163dc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
  1415
d2f19ff163dc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
  1416
!Archiver::XarArchive class methodsFor:'queries'!
d2f19ff163dc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
  1417
d2f19ff163dc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
  1418
canAddFiles
d2f19ff163dc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
  1419
d2f19ff163dc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
  1420
    ^ false
d2f19ff163dc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
  1421
!
d2f19ff163dc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
  1422
d2f19ff163dc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
  1423
canRemoveFiles
d2f19ff163dc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
  1424
d2f19ff163dc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
  1425
    ^ false
d2f19ff163dc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
  1426
!
d2f19ff163dc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
  1427
d2f19ff163dc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
  1428
canViewFile
d2f19ff163dc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
  1429
d2f19ff163dc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
  1430
    ^ true
d2f19ff163dc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
  1431
! !
d2f19ff163dc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
  1432
d2f19ff163dc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
  1433
!Archiver::XarArchive methodsFor:'columns'!
d2f19ff163dc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
  1434
d2f19ff163dc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
  1435
columns
d2f19ff163dc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
  1436
d2f19ff163dc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
  1437
    "/  colums id/readSelector words to read
d2f19ff163dc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
  1438
    ^ #(      
d2f19ff163dc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
  1439
         #(#fileName        #rest)
d2f19ff163dc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
  1440
    ) 
d2f19ff163dc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
  1441
!
d2f19ff163dc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
  1442
d2f19ff163dc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
  1443
isValidOutputLine:line
d2f19ff163dc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
  1444
    ^ true
d2f19ff163dc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
  1445
! !
d2f19ff163dc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
  1446
d2f19ff163dc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
  1447
!Archiver::XarArchive methodsFor:'command strings'!
d2f19ff163dc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
  1448
d2f19ff163dc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
  1449
getCommandToExtractFiles:sel intoDirectory:dir 
d2f19ff163dc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
  1450
    |stream|
d2f19ff163dc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
  1451
d2f19ff163dc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
  1452
    stream := WriteStream on:''.
d2f19ff163dc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
  1453
d2f19ff163dc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
  1454
    "/ '-x'  TarArchivUnpackOption
d2f19ff163dc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
  1455
    "/ '-f'  TarArchivFileOption
d2f19ff163dc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
  1456
    "/ '-C'  TarArchivUnpackInDirectoryOption
d2f19ff163dc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
  1457
    stream nextPutAll:('%1 -x  -C %3 -f "%2"' 
d2f19ff163dc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
  1458
                    bindWith:self class xarCommand
d2f19ff163dc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
  1459
                    with:self fileName asString string
d2f19ff163dc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
  1460
                    with:dir asString).
d2f19ff163dc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
  1461
d2f19ff163dc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
  1462
    sel notNil ifTrue:[
d2f19ff163dc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
  1463
        sel do:[:el | 
d2f19ff163dc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
  1464
            stream nextPutAll:' "'.
d2f19ff163dc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
  1465
            stream nextPutAll:(el asString).
d2f19ff163dc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
  1466
            stream nextPutAll:'"'
d2f19ff163dc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
  1467
        ].
d2f19ff163dc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
  1468
    ].
d2f19ff163dc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
  1469
    ^ stream contents.
d2f19ff163dc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
  1470
!
d2f19ff163dc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
  1471
d2f19ff163dc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
  1472
getCommandToListFiles:aColOfFiles 
d2f19ff163dc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
  1473
    |stream|
d2f19ff163dc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
  1474
d2f19ff163dc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
  1475
    stream := WriteStream on:''.
d2f19ff163dc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
  1476
d2f19ff163dc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
  1477
    "/ '-t'  TarArchivListContentsOption
d2f19ff163dc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
  1478
    "/ '-f'  TarArchivFileOption
d2f19ff163dc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
  1479
    stream nextPutAll:('%1 -t -f "%2"' 
d2f19ff163dc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
  1480
                    bindWith:self class xarCommand
d2f19ff163dc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
  1481
                    with:self fileName baseName).
d2f19ff163dc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
  1482
d2f19ff163dc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
  1483
    stream nextPutAll:(self class stringWithQuotedFileBaseNames:aColOfFiles).
d2f19ff163dc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
  1484
    ^ stream contents.
d2f19ff163dc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
  1485
! !
d2f19ff163dc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
  1486
1086
2af5aca23dba zip added
penk
parents: 1085
diff changeset
  1487
!Archiver::ZipArchive class methodsFor:'command strings'!
2af5aca23dba zip added
penk
parents: 1085
diff changeset
  1488
1215
c3fe5597c1ec refactored
Claus Gittinger <cg@exept.de>
parents: 1205
diff changeset
  1489
unzipCommand
2646
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1490
    |cmdString s cmd|
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1491
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1492
    OperatingSystem isUNIXlike ifTrue:[
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1493
        ^ 'unzip'
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1494
    ].
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1495
    OperatingSystem isMSWINDOWSlike ifTrue:[
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1496
        cmdString := MIMETypes defaultCommandTemplateToOpenMimeType:'application/x-zip-compressed'.
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1497
        cmdString notEmptyOrNil ifTrue:[
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1498
            s := cmdString readStream.
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1499
            s skipSeparators.
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1500
            s peek == $" ifTrue:[
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1501
                s next.
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1502
                cmd := (s upTo:$")
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1503
            ] ifFalse:[
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1504
                cmd := s upToSeparator.
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1505
            ].
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1506
            ^ cmd
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1507
        ].
3787
93aaeeb4a239 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 3651
diff changeset
  1508
        ^ 'winrar.exe'
2646
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1509
    ].
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1510
    ^ nil
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1511
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1512
    "
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1513
     self unzipCommand    
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1514
    "
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1515
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1516
    "Modified: / 16-09-2011 / 17:26:18 / cg"
1086
2af5aca23dba zip added
penk
parents: 1085
diff changeset
  1517
!
2af5aca23dba zip added
penk
parents: 1085
diff changeset
  1518
1215
c3fe5597c1ec refactored
Claus Gittinger <cg@exept.de>
parents: 1205
diff changeset
  1519
zipCommand
2646
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1520
    OperatingSystem isUNIXlike ifTrue:[
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1521
        ^ 'zip'
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1522
    ].
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1523
    OperatingSystem isMSWINDOWSlike ifTrue:[
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1524
        ^ self unzipCommand.
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1525
    ].
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1526
    ^ nil
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1527
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1528
    "Modified: / 16-09-2011 / 16:26:00 / cg"
1086
2af5aca23dba zip added
penk
parents: 1085
diff changeset
  1529
! !
2af5aca23dba zip added
penk
parents: 1085
diff changeset
  1530
2af5aca23dba zip added
penk
parents: 1085
diff changeset
  1531
!Archiver::ZipArchive class methodsFor:'queries'!
2af5aca23dba zip added
penk
parents: 1085
diff changeset
  1532
2af5aca23dba zip added
penk
parents: 1085
diff changeset
  1533
canAddFiles
2af5aca23dba zip added
penk
parents: 1085
diff changeset
  1534
2af5aca23dba zip added
penk
parents: 1085
diff changeset
  1535
    ^ true
2af5aca23dba zip added
penk
parents: 1085
diff changeset
  1536
!
2af5aca23dba zip added
penk
parents: 1085
diff changeset
  1537
2af5aca23dba zip added
penk
parents: 1085
diff changeset
  1538
canRemoveFiles
2af5aca23dba zip added
penk
parents: 1085
diff changeset
  1539
2af5aca23dba zip added
penk
parents: 1085
diff changeset
  1540
    ^ true
1088
f859684fd729 next stage
penk
parents: 1087
diff changeset
  1541
!
f859684fd729 next stage
penk
parents: 1087
diff changeset
  1542
1138
5232eb3c94e0 canView is true for ZipArchives
Claus Gittinger <cg@exept.de>
parents: 1131
diff changeset
  1543
canViewFile
5232eb3c94e0 canView is true for ZipArchives
Claus Gittinger <cg@exept.de>
parents: 1131
diff changeset
  1544
5232eb3c94e0 canView is true for ZipArchives
Claus Gittinger <cg@exept.de>
parents: 1131
diff changeset
  1545
    ^ true
5232eb3c94e0 canView is true for ZipArchives
Claus Gittinger <cg@exept.de>
parents: 1131
diff changeset
  1546
!
5232eb3c94e0 canView is true for ZipArchives
Claus Gittinger <cg@exept.de>
parents: 1131
diff changeset
  1547
1088
f859684fd729 next stage
penk
parents: 1087
diff changeset
  1548
hasLastLine
f859684fd729 next stage
penk
parents: 1087
diff changeset
  1549
    ^ true
f859684fd729 next stage
penk
parents: 1087
diff changeset
  1550
!
f859684fd729 next stage
penk
parents: 1087
diff changeset
  1551
f859684fd729 next stage
penk
parents: 1087
diff changeset
  1552
hasTitleLine
f859684fd729 next stage
penk
parents: 1087
diff changeset
  1553
    ^ true
1086
2af5aca23dba zip added
penk
parents: 1085
diff changeset
  1554
! !
2af5aca23dba zip added
penk
parents: 1085
diff changeset
  1555
5368
17fbe26c92e3 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5221
diff changeset
  1556
!Archiver::ZipArchive methodsFor:'actions'!
17fbe26c92e3 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5221
diff changeset
  1557
5369
f64acbdfd05c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5368
diff changeset
  1558
extractFiles:colOfFilesOrNilForAll to:aDirectory
5368
17fbe26c92e3 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5221
diff changeset
  1559
    "called both to really extract, 
17fbe26c92e3 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5221
diff changeset
  1560
     and to extract to a temporary file to view it"
17fbe26c92e3 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5221
diff changeset
  1561
17fbe26c92e3 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5221
diff changeset
  1562
    self useBuiltinArchiver ifTrue:[
5369
f64acbdfd05c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5368
diff changeset
  1563
        self extractFilesUsingBuiltinZipArchiver:colOfFilesOrNilForAll from:self fileName to:aDirectory.
5368
17fbe26c92e3 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5221
diff changeset
  1564
        ^ self
17fbe26c92e3 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5221
diff changeset
  1565
    ].
5369
f64acbdfd05c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5368
diff changeset
  1566
    ^ super extractFiles:colOfFilesOrNilForAll to:aDirectory.
5368
17fbe26c92e3 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5221
diff changeset
  1567
!
17fbe26c92e3 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5221
diff changeset
  1568
5369
f64acbdfd05c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5368
diff changeset
  1569
extractFilesUsingBuiltinZipArchiver:colOfArchivItemsOrNilForAll from:fn to:aDirectory
5368
17fbe26c92e3 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5221
diff changeset
  1570
    "called both to really extract, 
17fbe26c92e3 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5221
diff changeset
  1571
     and to extract to a temporary file to view it"
17fbe26c92e3 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5221
diff changeset
  1572
5369
f64acbdfd05c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5368
diff changeset
  1573
    |zip names|
5368
17fbe26c92e3 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5221
diff changeset
  1574
5398
e2e877f8a72d #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5397
diff changeset
  1575
    zip := (Smalltalk at:#ZipArchive) oldFileNamed:fn.
5369
f64acbdfd05c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5368
diff changeset
  1576
    colOfArchivItemsOrNilForAll isNil ifTrue:[
f64acbdfd05c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5368
diff changeset
  1577
        names := zip entries.
f64acbdfd05c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5368
diff changeset
  1578
    ] ifFalse:[
f64acbdfd05c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5368
diff changeset
  1579
        names := colOfArchivItemsOrNilForAll collect:#fileName
f64acbdfd05c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5368
diff changeset
  1580
    ].
f64acbdfd05c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5368
diff changeset
  1581
    names do:[:eachName |
f64acbdfd05c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5368
diff changeset
  1582
        |entry targetFn|
5368
17fbe26c92e3 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5221
diff changeset
  1583
5369
f64acbdfd05c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5368
diff changeset
  1584
        self assert:(eachName includesString:'..') not.
f64acbdfd05c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5368
diff changeset
  1585
        self assert:eachName asFilename isAbsolute not.
5368
17fbe26c92e3 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5221
diff changeset
  1586
5369
f64acbdfd05c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5368
diff changeset
  1587
        targetFn := aDirectory construct:eachName.
5368
17fbe26c92e3 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5221
diff changeset
  1588
5369
f64acbdfd05c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5368
diff changeset
  1589
        entry := zip memberNamed:eachName.
f64acbdfd05c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5368
diff changeset
  1590
        entry isDirectory ifTrue:[
f64acbdfd05c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5368
diff changeset
  1591
            targetFn recursiveMakeDirectory.
f64acbdfd05c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5368
diff changeset
  1592
        ] ifFalse:[
f64acbdfd05c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5368
diff changeset
  1593
            targetFn directory recursiveMakeDirectory.
f64acbdfd05c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5368
diff changeset
  1594
f64acbdfd05c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5368
diff changeset
  1595
            targetFn writingFileDo:[:s |
f64acbdfd05c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5368
diff changeset
  1596
                zip extract:eachName toStream:s.
f64acbdfd05c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5368
diff changeset
  1597
            ].
f64acbdfd05c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5368
diff changeset
  1598
        ]
5368
17fbe26c92e3 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5221
diff changeset
  1599
    ].
17fbe26c92e3 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5221
diff changeset
  1600
    zip close.
17fbe26c92e3 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5221
diff changeset
  1601
!
17fbe26c92e3 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5221
diff changeset
  1602
17fbe26c92e3 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5221
diff changeset
  1603
listFiles:aColOfFiles
17fbe26c92e3 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5221
diff changeset
  1604
    |fn cmd dir|
17fbe26c92e3 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5221
diff changeset
  1605
17fbe26c92e3 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5221
diff changeset
  1606
    (fn := self fileName) isNil ifTrue:[ ^ self].
17fbe26c92e3 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5221
diff changeset
  1607
    dir := fn directory.
17fbe26c92e3 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5221
diff changeset
  1608
    cmd := self getCommandToListFiles:aColOfFiles.
17fbe26c92e3 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5221
diff changeset
  1609
    cmd isNil ifTrue:[
17fbe26c92e3 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5221
diff changeset
  1610
        "/ no list command configured/found.
5397
34bcf65daa66 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5370
diff changeset
  1611
        (Smalltalk at:#ZipArchive) notNil ifTrue:[
34bcf65daa66 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5370
diff changeset
  1612
            "/ try smalltalk zipArchive...
34bcf65daa66 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5370
diff changeset
  1613
            fn mimeTypeOfContents = 'application/x-zip-compressed' ifTrue:[
34bcf65daa66 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5370
diff changeset
  1614
                self useBuiltinArchiver:true.
34bcf65daa66 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5370
diff changeset
  1615
                self listFilesUsingBuiltinZipArchiverFrom:fn.
34bcf65daa66 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5370
diff changeset
  1616
                ^ self.
34bcf65daa66 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5370
diff changeset
  1617
            ]
5368
17fbe26c92e3 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5221
diff changeset
  1618
        ].
17fbe26c92e3 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5221
diff changeset
  1619
    ].
17fbe26c92e3 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5221
diff changeset
  1620
    ^ super listFiles:aColOfFiles.
17fbe26c92e3 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5221
diff changeset
  1621
17fbe26c92e3 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5221
diff changeset
  1622
    "Modified: / 16-09-2011 / 16:33:50 / cg"
17fbe26c92e3 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5221
diff changeset
  1623
!
17fbe26c92e3 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5221
diff changeset
  1624
17fbe26c92e3 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5221
diff changeset
  1625
listFilesUsingBuiltinZipArchiverFrom:fn
17fbe26c92e3 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5221
diff changeset
  1626
    |zip members names|
17fbe26c92e3 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5221
diff changeset
  1627
17fbe26c92e3 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5221
diff changeset
  1628
    outStream nextPutLine:'dummy headline'.
5397
34bcf65daa66 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5370
diff changeset
  1629
    zip := (Smalltalk at:#ZipArchive) oldFileNamed:fn.
5368
17fbe26c92e3 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5221
diff changeset
  1630
    members := zip zipMembersByName.
17fbe26c92e3 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5221
diff changeset
  1631
    names := members keys copyAsOrderedCollection sort.
17fbe26c92e3 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5221
diff changeset
  1632
    names do:[:eachName |
17fbe26c92e3 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5221
diff changeset
  1633
        |entry|
17fbe26c92e3 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5221
diff changeset
  1634
17fbe26c92e3 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5221
diff changeset
  1635
        entry := members at:eachName.
17fbe26c92e3 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5221
diff changeset
  1636
        "/ generate a line of the form:
17fbe26c92e3 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5221
diff changeset
  1637
        "/      [-d][-r][-w][-x]
17fbe26c92e3 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5221
diff changeset
  1638
        outStream nextPutLine:('%1 %2 %3 %4 %5 %6 %7 %8 %9 %10' 
17fbe26c92e3 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5221
diff changeset
  1639
                                    bindWithArguments:{
17fbe26c92e3 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5221
diff changeset
  1640
                                        (entry isDirectory ifTrue:['d'] ifFalse:['-']),'r','-','-' . "/ permissions (%1)
17fbe26c92e3 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5221
diff changeset
  1641
                                        0 . 0                                                    . "/ version (%2, %3)         
17fbe26c92e3 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5221
diff changeset
  1642
                                        entry uncompressedSize                                    . "/ size %4        
17fbe26c92e3 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5221
diff changeset
  1643
                                        'file'                                                   . "/ type %5
17fbe26c92e3 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5221
diff changeset
  1644
                                        1                                                        . "/ ratio %6
17fbe26c92e3 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5221
diff changeset
  1645
                                        'x'                                                      . "/ unused %7
17fbe26c92e3 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5221
diff changeset
  1646
                                        '1-1-1970'                                               . "/ date %8
17fbe26c92e3 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5221
diff changeset
  1647
                                        '00:00:00'                                               . "/ time %9
17fbe26c92e3 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5221
diff changeset
  1648
                                        eachName                                                   "/ fn
17fbe26c92e3 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5221
diff changeset
  1649
                                      }).
17fbe26c92e3 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5221
diff changeset
  1650
    ].
17fbe26c92e3 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5221
diff changeset
  1651
    zip close.
17fbe26c92e3 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5221
diff changeset
  1652
! !
17fbe26c92e3 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5221
diff changeset
  1653
1246
1eefc3a60863 output parsing refactored;
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
  1654
!Archiver::ZipArchive methodsFor:'columns'!
1eefc3a60863 output parsing refactored;
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
  1655
1eefc3a60863 output parsing refactored;
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
  1656
columns
1eefc3a60863 output parsing refactored;
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
  1657
1247
4c628a0455c1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1246
diff changeset
  1658
    "/  colums id/readSelector    words to read
1591
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
  1659
    ^ #( (#permissions     1)      
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
  1660
         (#version         2)    
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
  1661
         (#size            1)     
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
  1662
         (#type            1)    
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
  1663
         (#ratio           1)    
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
  1664
         (nil              1)  
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
  1665
         (#dateAndTime     2)  
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
  1666
         (#fileName        #rest)
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
  1667
    ) 
1246
1eefc3a60863 output parsing refactored;
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
  1668
!
1eefc3a60863 output parsing refactored;
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
  1669
1eefc3a60863 output parsing refactored;
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
  1670
isValidOutputLine:line
4219
7ecd6ba2b202 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 4103
diff changeset
  1671
    ('[-d][-r][-w][-x]' match:(line copyToMax:4)) ifTrue:[^ true].
1246
1eefc3a60863 output parsing refactored;
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
  1672
    ^ false.
1eefc3a60863 output parsing refactored;
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
  1673
! !
1eefc3a60863 output parsing refactored;
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
  1674
1086
2af5aca23dba zip added
penk
parents: 1085
diff changeset
  1675
!Archiver::ZipArchive methodsFor:'command strings'!
2af5aca23dba zip added
penk
parents: 1085
diff changeset
  1676
1215
c3fe5597c1ec refactored
Claus Gittinger <cg@exept.de>
parents: 1205
diff changeset
  1677
getCommandToAdd:aColOfFiles toArchive:archiveFile
2646
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1678
    "archiveFile exists ifFalse:[^ nil]."
1088
f859684fd729 next stage
penk
parents: 1087
diff changeset
  1679
2646
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1680
    OperatingSystem isUNIXlike ifTrue:[
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1681
        ^ String streamContents:[:s |
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1682
                s nextPutAll:('%1 -r "%2"' 
1591
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
  1683
                    bindWith:self class zipCommand
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
  1684
                    with:archiveFile asString string).
1088
f859684fd729 next stage
penk
parents: 1087
diff changeset
  1685
2646
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1686
                self 
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1687
                    addDoubleQuotedFilenames:(aColOfFiles collect:[:each | each asFilename baseName])
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1688
                    toStream:s.
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1689
        ].
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1690
    ].
1215
c3fe5597c1ec refactored
Claus Gittinger <cg@exept.de>
parents: 1205
diff changeset
  1691
2646
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1692
    ^ nil
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1693
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1694
    "Modified (comment): / 16-09-2011 / 16:27:20 / cg"
1086
2af5aca23dba zip added
penk
parents: 1085
diff changeset
  1695
!
2af5aca23dba zip added
penk
parents: 1085
diff changeset
  1696
1246
1eefc3a60863 output parsing refactored;
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
  1697
getCommandToExtractFiles:aColOfFiles intoDirectory:dir
2646
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1698
    |cmd template|
1087
d6bfc66a3860 next stage
penk
parents: 1086
diff changeset
  1699
2646
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1700
    cmd := self class unzipCommand.
1145
9a6688b7139a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
  1701
2646
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1702
    OperatingSystem isUNIXlike ifTrue:[
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1703
        template := '%1 -o -d "%2" "%3"'
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1704
    ].
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1705
    OperatingSystem isMSDOSlike ifTrue:[
3007
778a3c6b9877 class: Archiver
Claus Gittinger <cg@exept.de>
parents: 2907
diff changeset
  1706
        self halt:'unhandled os'.
2646
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1707
    ].
1087
d6bfc66a3860 next stage
penk
parents: 1086
diff changeset
  1708
2646
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1709
    template notNil ifTrue:[
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1710
        ^ String streamContents:[:s |
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1711
            "/ -o   UnzipOverwriteExistingFilesOption
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1712
            "/ -d   UnzipExtDirectoryOption
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1713
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1714
            s nextPutAll:(template 
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1715
                    bindWith:cmd
1591
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
  1716
                    with:dir asString string
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
  1717
                    with:self fileName asString).
1086
2af5aca23dba zip added
penk
parents: 1085
diff changeset
  1718
2646
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1719
            self addDoubleQuotedFilenames:aColOfFiles toStream:s.
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1720
        ]
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1721
    ].
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1722
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1723
    ^ nil.
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1724
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1725
    "Modified: / 16-09-2011 / 16:38:57 / cg"
1086
2af5aca23dba zip added
penk
parents: 1085
diff changeset
  1726
!
2af5aca23dba zip added
penk
parents: 1085
diff changeset
  1727
1591
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
  1728
getCommandToListFiles:aColOfFiles 
2690
Claus Gittinger <cg@exept.de>
parents: 2689
diff changeset
  1729
    |cmd headlessCmd template|
1086
2af5aca23dba zip added
penk
parents: 1085
diff changeset
  1730
2646
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1731
    cmd := self class unzipCommand.
1144
75008d5f9632 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1139
diff changeset
  1732
2646
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1733
    OperatingSystem isUNIXlike ifTrue:[
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1734
        "/  -Z      ZipInfoOption
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1735
        "/  -h      ZipHeaderOption
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1736
        "/  -t      ZipTotalOption
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1737
        template := '"%1" -Z -m -h "%2"'
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1738
    ].
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1739
    OperatingSystem isMSDOSlike ifTrue:[
4219
7ecd6ba2b202 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 4103
diff changeset
  1740
        |mapping cmdBasename|
7ecd6ba2b202 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 4103
diff changeset
  1741
7ecd6ba2b202 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 4103
diff changeset
  1742
        mapping := #('winrar.exe' 'rar.exe'     '"%1" l "%2"'
7ecd6ba2b202 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 4103
diff changeset
  1743
"/ does not work yet:
7ecd6ba2b202 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 4103
diff changeset
  1744
"/                     '7zFM.exe'   '7z.exe'      '"%1" l "%2"'
7ecd6ba2b202 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 4103
diff changeset
  1745
                    ).
7ecd6ba2b202 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 4103
diff changeset
  1746
        cmdBasename := cmd asFilename baseName.
7ecd6ba2b202 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 4103
diff changeset
  1747
        mapping inGroupsOf:3 do:[:originalBasename :mappedBasename :templ|
7ecd6ba2b202 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 4103
diff changeset
  1748
            (cmdBasename sameAs:originalBasename) ifTrue:[
7ecd6ba2b202 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 4103
diff changeset
  1749
                headlessCmd := cmd asFilename directory construct:mappedBasename.
7ecd6ba2b202 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 4103
diff changeset
  1750
                headlessCmd isExecutableProgram ifTrue:[
7ecd6ba2b202 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 4103
diff changeset
  1751
                    cmd := headlessCmd pathName.
7ecd6ba2b202 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 4103
diff changeset
  1752
                    template := templ.
7ecd6ba2b202 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 4103
diff changeset
  1753
                ].
2690
Claus Gittinger <cg@exept.de>
parents: 2689
diff changeset
  1754
            ].
4219
7ecd6ba2b202 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 4103
diff changeset
  1755
        ].
7ecd6ba2b202 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 4103
diff changeset
  1756
        template isNil ifTrue:[
5368
17fbe26c92e3 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5221
diff changeset
  1757
            self breakPoint:#cg info:'unknown command'
4219
7ecd6ba2b202 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 4103
diff changeset
  1758
        ].
2646
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1759
    ].
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1760
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1761
    template notNil ifTrue:[
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1762
        ^ String streamContents:[:s |
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1763
            s nextPutAll:(template 
4219
7ecd6ba2b202 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 4103
diff changeset
  1764
                            bindWith:cmd with:self fileName asString string).
1139
aea281a4e983 zip file list
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1765
2646
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1766
            aColOfFiles notNil ifTrue:[       
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1767
                self breakPoint:#ca.
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1768
                self 
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1769
                    addDoubleQuotedFilenames:(aColOfFiles collect:[:each | each asFilename baseName])
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1770
                    toStream:s.
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1771
            ].
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1772
        ].
1086
2af5aca23dba zip added
penk
parents: 1085
diff changeset
  1773
    ].
2646
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1774
    ^ nil.
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1775
2690
Claus Gittinger <cg@exept.de>
parents: 2689
diff changeset
  1776
    "Modified: / 29-11-2011 / 20:19:18 / cg"
1086
2af5aca23dba zip added
penk
parents: 1085
diff changeset
  1777
!
2af5aca23dba zip added
penk
parents: 1085
diff changeset
  1778
1591
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
  1779
getCommandToRemoveFiles:aColOfFiles 
2646
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1780
    OperatingSystem isUNIXlike ifTrue:[
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1781
        ^ String streamContents:[:s |
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1782
            s nextPutAll:('%1 -d "%2"' 
1591
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
  1783
                        bindWith:self class zipCommand
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
  1784
                        with:self fileName asString string).
1088
f859684fd729 next stage
penk
parents: 1087
diff changeset
  1785
2646
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1786
            self addDoubleQuotedFilenames:aColOfFiles toStream:s.
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1787
        ]
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1788
    ].
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1789
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1790
    ^ nil.
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1791
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1792
    "Modified: / 16-09-2011 / 16:29:09 / cg"
1086
2af5aca23dba zip added
penk
parents: 1085
diff changeset
  1793
! !
2af5aca23dba zip added
penk
parents: 1085
diff changeset
  1794
1085
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
  1795
!Archiver class methodsFor:'documentation'!
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
  1796
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
  1797
version
3651
abfe8e55ceaf #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 3512
diff changeset
  1798
    ^ '$Header$'
2689
916e23097292 changed: #initialize
Claus Gittinger <cg@exept.de>
parents: 2688
diff changeset
  1799
!
916e23097292 changed: #initialize
Claus Gittinger <cg@exept.de>
parents: 2688
diff changeset
  1800
916e23097292 changed: #initialize
Claus Gittinger <cg@exept.de>
parents: 2688
diff changeset
  1801
version_CVS
3651
abfe8e55ceaf #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 3512
diff changeset
  1802
    ^ '$Header$'
1085
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
  1803
! !
1591
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
  1804