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