Archiver.st
author Claus Gittinger <cg@exept.de>
Tue, 24 Apr 2018 09:58:20 +0200
changeset 4637 1d8bc0d9423a
parent 4584 bb1b80fa1cdd
child 4771 994d4aaf474d
permissions -rw-r--r--
#REFACTORING by cg class: Archiver::LZipArchive changed: #getCommandToExtractFiles:intoDirectory:
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
1591
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
   224
    |fn 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.
1591
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
   227
    archiverClass := self classForMimeType:fn mimeTypeFromName fileName:fn.
1215
c3fe5597c1ec refactored
Claus Gittinger <cg@exept.de>
parents: 1205
diff changeset
   228
    archiverClass isNil ifTrue:[^ nil].
1591
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
   229
    ^ archiverClass with:fn
1215
c3fe5597c1ec refactored
Claus Gittinger <cg@exept.de>
parents: 1205
diff changeset
   230
!
c3fe5597c1ec refactored
Claus Gittinger <cg@exept.de>
parents: 1205
diff changeset
   231
1085
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   232
with:aFilename
1591
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
   233
    ^ self new fileName:aFilename.
1085
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   234
! !
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   235
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   236
!Archiver class methodsFor:'classAccess'!
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   237
1383
527dcd29a97b added ar-archive (unix object-libraries)
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
   238
arArchive
527dcd29a97b added ar-archive (unix object-libraries)
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
   239
527dcd29a97b added ar-archive (unix object-libraries)
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
   240
    ^ ArArchive
527dcd29a97b added ar-archive (unix object-libraries)
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
   241
!
527dcd29a97b added ar-archive (unix object-libraries)
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
   242
1085
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   243
gzipArchive
1392
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   244
    ^ GZipCompressed
1085
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   245
!
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   246
4584
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
   247
lzipArchive
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
   248
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
   249
    ^ LZipArchive
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
   250
!
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
   251
1085
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   252
tarArchive
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   253
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   254
    ^ TarArchive
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   255
!
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   256
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   257
tarGZipArchive
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   258
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   259
    ^ TarGZipArchive
1086
2af5aca23dba zip added
penk
parents: 1085
diff changeset
   260
!
2af5aca23dba zip added
penk
parents: 1085
diff changeset
   261
2af5aca23dba zip added
penk
parents: 1085
diff changeset
   262
zipArchive
2af5aca23dba zip added
penk
parents: 1085
diff changeset
   263
2af5aca23dba zip added
penk
parents: 1085
diff changeset
   264
    ^ ZipArchive
1085
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   265
! !
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   266
1246
1eefc3a60863 output parsing refactored;
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
   267
!Archiver class methodsFor:'columns'!
1eefc3a60863 output parsing refactored;
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
   268
1eefc3a60863 output parsing refactored;
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
   269
columns
1eefc3a60863 output parsing refactored;
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
   270
    self subclassResponsibility
1eefc3a60863 output parsing refactored;
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
   271
! !
1eefc3a60863 output parsing refactored;
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
   272
1255
32e0aa97ae82 gzip archiver stuff fixed.
Claus Gittinger <cg@exept.de>
parents: 1247
diff changeset
   273
!Archiver class methodsFor:'command strings'!
32e0aa97ae82 gzip archiver stuff fixed.
Claus Gittinger <cg@exept.de>
parents: 1247
diff changeset
   274
32e0aa97ae82 gzip archiver stuff fixed.
Claus Gittinger <cg@exept.de>
parents: 1247
diff changeset
   275
stringWithQuotedFileBaseNames:aColOfFiles
32e0aa97ae82 gzip archiver stuff fixed.
Claus Gittinger <cg@exept.de>
parents: 1247
diff changeset
   276
32e0aa97ae82 gzip archiver stuff fixed.
Claus Gittinger <cg@exept.de>
parents: 1247
diff changeset
   277
    aColOfFiles isNil ifTrue:[^ ''].
32e0aa97ae82 gzip archiver stuff fixed.
Claus Gittinger <cg@exept.de>
parents: 1247
diff changeset
   278
1591
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
   279
    ^ String 
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
   280
        streamContents:[:str |
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
   281
            aColOfFiles do:[:fn | 
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
   282
                str nextPutAll:' "'.
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
   283
                str nextPutAll:(fn asFilename baseName).
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
   284
                str nextPutAll:'"'.
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
   285
            ].
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
   286
        ]
1255
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
1246
1eefc3a60863 output parsing refactored;
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
   289
!Archiver class methodsFor:'commandOutputReader'!
1eefc3a60863 output parsing refactored;
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
   290
1eefc3a60863 output parsing refactored;
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
   291
commandOutputParser
1eefc3a60863 output parsing refactored;
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
   292
    ^ self commandOutputParserClass new
1eefc3a60863 output parsing refactored;
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
   293
!
1eefc3a60863 output parsing refactored;
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
   294
1eefc3a60863 output parsing refactored;
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
   295
commandOutputParserClass
1eefc3a60863 output parsing refactored;
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
   296
    ^ ArchiverOutputParser
1eefc3a60863 output parsing refactored;
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
   297
! !
1eefc3a60863 output parsing refactored;
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
   298
1086
2af5aca23dba zip added
penk
parents: 1085
diff changeset
   299
!Archiver class methodsFor:'queries'!
2af5aca23dba zip added
penk
parents: 1085
diff changeset
   300
2af5aca23dba zip added
penk
parents: 1085
diff changeset
   301
canAddFiles
2af5aca23dba zip added
penk
parents: 1085
diff changeset
   302
2af5aca23dba zip added
penk
parents: 1085
diff changeset
   303
    ^ false
2af5aca23dba zip added
penk
parents: 1085
diff changeset
   304
!
2af5aca23dba zip added
penk
parents: 1085
diff changeset
   305
1106
893c2c508df1 checkin from browser
penk
parents: 1098
diff changeset
   306
canDragnDrop
893c2c508df1 checkin from browser
penk
parents: 1098
diff changeset
   307
893c2c508df1 checkin from browser
penk
parents: 1098
diff changeset
   308
    ^ true.
893c2c508df1 checkin from browser
penk
parents: 1098
diff changeset
   309
!
893c2c508df1 checkin from browser
penk
parents: 1098
diff changeset
   310
1098
4b5a0721ec55 checkin from browser
penk
parents: 1089
diff changeset
   311
canExtractFiles
4b5a0721ec55 checkin from browser
penk
parents: 1089
diff changeset
   312
4b5a0721ec55 checkin from browser
penk
parents: 1089
diff changeset
   313
    ^ false
4b5a0721ec55 checkin from browser
penk
parents: 1089
diff changeset
   314
!
4b5a0721ec55 checkin from browser
penk
parents: 1089
diff changeset
   315
1086
2af5aca23dba zip added
penk
parents: 1085
diff changeset
   316
canRemoveFiles
2af5aca23dba zip added
penk
parents: 1085
diff changeset
   317
2af5aca23dba zip added
penk
parents: 1085
diff changeset
   318
    ^ false
2af5aca23dba zip added
penk
parents: 1085
diff changeset
   319
!
2af5aca23dba zip added
penk
parents: 1085
diff changeset
   320
1106
893c2c508df1 checkin from browser
penk
parents: 1098
diff changeset
   321
canViewFile
893c2c508df1 checkin from browser
penk
parents: 1098
diff changeset
   322
893c2c508df1 checkin from browser
penk
parents: 1098
diff changeset
   323
    ^ false
893c2c508df1 checkin from browser
penk
parents: 1098
diff changeset
   324
!
893c2c508df1 checkin from browser
penk
parents: 1098
diff changeset
   325
1086
2af5aca23dba zip added
penk
parents: 1085
diff changeset
   326
hasTitleLine
2af5aca23dba zip added
penk
parents: 1085
diff changeset
   327
2af5aca23dba zip added
penk
parents: 1085
diff changeset
   328
    ^ false
3651
abfe8e55ceaf #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 3512
diff changeset
   329
!
abfe8e55ceaf #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 3512
diff changeset
   330
abfe8e55ceaf #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 3512
diff changeset
   331
isAbstract
abfe8e55ceaf #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 3512
diff changeset
   332
    ^ self == Archiver
1086
2af5aca23dba zip added
penk
parents: 1085
diff changeset
   333
! !
2af5aca23dba zip added
penk
parents: 1085
diff changeset
   334
1085
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   335
!Archiver methodsFor:'accessing'!
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   336
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   337
errorStream
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   338
    "return the value of the instance variable 'errorStream' (automatically generated)"
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   339
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   340
    ^ errorStream
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   341
!
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   342
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   343
errorStream:something
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   344
    "set the value of the instance variable 'errorStream' (automatically generated)"
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   345
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   346
    errorStream := something.
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   347
!
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   348
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   349
fileName
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   350
    "return the value of the instance variable 'fileName' (automatically generated)"
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   351
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   352
    ^ fileName
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   353
!
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   354
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   355
fileName:something
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   356
    "set the value of the instance variable 'fileName' (automatically generated)"
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   357
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   358
    fileName := something.
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   359
!
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   360
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   361
outStream
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   362
    "return the value of the instance variable 'outStream' (automatically generated)"
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   363
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   364
    ^ outStream
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   365
!
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   366
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   367
outStream:something
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   368
    "set the value of the instance variable 'outStream' (automatically generated)"
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   369
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   370
    outStream := something.
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   371
!
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   372
4244
66c023206027 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 4219
diff changeset
   373
outStream:anOutStream errorStream:anErrorStream synchron:aBoolean
66c023206027 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 4219
diff changeset
   374
    outStream := anOutStream.
66c023206027 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 4219
diff changeset
   375
    errorStream := anErrorStream.
66c023206027 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 4219
diff changeset
   376
    synchron := aBoolean
66c023206027 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 4219
diff changeset
   377
!
66c023206027 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 4219
diff changeset
   378
1085
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   379
process
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   380
    "return the value of the instance variable 'process' (automatically generated)"
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   381
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   382
    ^ process
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   383
!
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   384
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   385
process:something
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   386
    "set the value of the instance variable 'process' (automatically generated)"
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   387
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   388
    process := something.
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   389
!
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   390
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   391
synchron
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   392
    "return the value of the instance variable 'synchron' (automatically generated)"
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   393
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   394
    ^ synchron
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   395
!
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   396
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   397
synchron:something
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   398
    "set the value of the instance variable 'synchron' (automatically generated)"
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   399
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   400
    synchron := something.
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   401
!
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   402
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   403
temporaryDirectory
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   404
    "return the value of the instance variable 'temporaryDirectory' (automatically generated)"
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   405
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   406
    temporaryDirectory isNil ifTrue:[
3027
552aa6706d4c class: Archiver
Stefan Vogel <sv@exept.de>
parents: 3007
diff changeset
   407
        temporaryDirectory := Filename newTemporaryDirectory.
1085
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   408
    ].
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   409
    ^ temporaryDirectory
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   410
! !
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   411
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   412
!Archiver methodsFor:'actions'!
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   413
1215
c3fe5597c1ec refactored
Claus Gittinger <cg@exept.de>
parents: 1205
diff changeset
   414
extractFilesTo:aDirectory
c3fe5597c1ec refactored
Claus Gittinger <cg@exept.de>
parents: 1205
diff changeset
   415
    self extractFiles:nil to:aDirectory
1085
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   416
!
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   417
4244
66c023206027 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 4219
diff changeset
   418
getCommandToListFiles:aColOfFiles
66c023206027 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 4219
diff changeset
   419
    self subclassResponsibility.
66c023206027 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 4219
diff changeset
   420
!
66c023206027 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 4219
diff changeset
   421
1255
32e0aa97ae82 gzip archiver stuff fixed.
Claus Gittinger <cg@exept.de>
parents: 1247
diff changeset
   422
listFiles:aColOfFiles
32e0aa97ae82 gzip archiver stuff fixed.
Claus Gittinger <cg@exept.de>
parents: 1247
diff changeset
   423
    |cmd dir|
32e0aa97ae82 gzip archiver stuff fixed.
Claus Gittinger <cg@exept.de>
parents: 1247
diff changeset
   424
32e0aa97ae82 gzip archiver stuff fixed.
Claus Gittinger <cg@exept.de>
parents: 1247
diff changeset
   425
    self fileName isNil ifTrue:[ ^ self].
32e0aa97ae82 gzip archiver stuff fixed.
Claus Gittinger <cg@exept.de>
parents: 1247
diff changeset
   426
    dir := self fileName directory.
32e0aa97ae82 gzip archiver stuff fixed.
Claus Gittinger <cg@exept.de>
parents: 1247
diff changeset
   427
    cmd := self getCommandToListFiles:aColOfFiles.
2646
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
   428
    cmd isNil ifTrue:[
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
   429
        errorStream nextPutLine:'No command to list the archive.'.
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
   430
        ^ self
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
   431
    ].
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
   432
    self executeCommand:cmd directory:dir
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
   433
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
   434
    "Modified: / 16-09-2011 / 16:33:50 / cg"
1255
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
1215
c3fe5597c1ec refactored
Claus Gittinger <cg@exept.de>
parents: 1205
diff changeset
   437
removeFilesFromArchive:aColOfFiles
1085
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   438
    self subclassResponsibility.
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   439
! !
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   440
1215
c3fe5597c1ec refactored
Claus Gittinger <cg@exept.de>
parents: 1205
diff changeset
   441
!Archiver methodsFor:'actions-basic'!
c3fe5597c1ec refactored
Claus Gittinger <cg@exept.de>
parents: 1205
diff changeset
   442
c3fe5597c1ec refactored
Claus Gittinger <cg@exept.de>
parents: 1205
diff changeset
   443
addFilesToArchive:colOfFiles
c3fe5597c1ec refactored
Claus Gittinger <cg@exept.de>
parents: 1205
diff changeset
   444
    self subclassResponsibility.
c3fe5597c1ec refactored
Claus Gittinger <cg@exept.de>
parents: 1205
diff changeset
   445
!
c3fe5597c1ec refactored
Claus Gittinger <cg@exept.de>
parents: 1205
diff changeset
   446
c3fe5597c1ec refactored
Claus Gittinger <cg@exept.de>
parents: 1205
diff changeset
   447
extractFiles:aColOfFilesOrNil to:aDirectory
c3fe5597c1ec refactored
Claus Gittinger <cg@exept.de>
parents: 1205
diff changeset
   448
    self subclassResponsibility.
c3fe5597c1ec refactored
Claus Gittinger <cg@exept.de>
parents: 1205
diff changeset
   449
! !
c3fe5597c1ec refactored
Claus Gittinger <cg@exept.de>
parents: 1205
diff changeset
   450
c3fe5597c1ec refactored
Claus Gittinger <cg@exept.de>
parents: 1205
diff changeset
   451
!Archiver methodsFor:'actions-private'!
1085
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   452
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   453
removeTemporaryDirectory
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   454
    temporaryDirectory notNil ifTrue:[
3490
a29c708667c9 class: Archiver
Stefan Vogel <sv@exept.de>
parents: 3471
diff changeset
   455
        self temporaryDirectory recursiveRemove.
1591
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
   456
        temporaryDirectory := nil.
1085
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   457
    ].
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   458
!
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   459
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   460
stopProcess
4244
66c023206027 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 4219
diff changeset
   461
    |p|
1085
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   462
4244
66c023206027 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 4219
diff changeset
   463
    p := process.
66c023206027 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 4219
diff changeset
   464
    p notNil ifTrue:[
66c023206027 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 4219
diff changeset
   465
        p terminateGroup.
66c023206027 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 4219
diff changeset
   466
        p waitUntilFinished.
66c023206027 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 4219
diff changeset
   467
        process := 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
!Archiver methodsFor:'command execution'!
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   472
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   473
executeCommand:cmd directory:aDirectory
4244
66c023206027 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 4219
diff changeset
   474
    |osProcess|
66c023206027 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 4219
diff changeset
   475
2646
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
   476
    cmd isNil ifTrue:[
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
   477
        errorStream nextPutAll:'No command for archive operation.'.
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
   478
        ^ false
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
   479
    ].
4244
66c023206027 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 4219
diff changeset
   480
    osProcess := OSProcess new
4559
41081992e085 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4315
diff changeset
   481
                    command:cmd directory:aDirectory;
4244
66c023206027 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 4219
diff changeset
   482
                    lineWise:true;          "do it lineWise, since outStream may be an ActorStream"
66c023206027 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 4219
diff changeset
   483
                    outStream:outStream;
4559
41081992e085 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4315
diff changeset
   484
                    errorStream:errorStream.
1085
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   485
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   486
    synchron isNil ifTrue:[synchron := true].
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   487
    synchron ifTrue:[
4244
66c023206027 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 4219
diff changeset
   488
        ^ osProcess execute.
1085
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   489
    ] ifFalse:[
4244
66c023206027 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 4219
diff changeset
   490
        osProcess terminateActionBlock:[process := nil].
66c023206027 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 4219
diff changeset
   491
        process := osProcess.
66c023206027 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 4219
diff changeset
   492
        ^ osProcess startProcess.
1085
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   493
    ]
2646
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
   494
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
   495
    "Modified: / 16-09-2011 / 16:32:37 / cg"
1085
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   496
!
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   497
1246
1eefc3a60863 output parsing refactored;
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
   498
isValidOutputLine:line
1eefc3a60863 output parsing refactored;
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
   499
    "return true, if line contains a valid list-files output line"
1eefc3a60863 output parsing refactored;
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
   500
1eefc3a60863 output parsing refactored;
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
   501
    self subclassResponsibility
1eefc3a60863 output parsing refactored;
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
   502
!
1eefc3a60863 output parsing refactored;
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
   503
1eefc3a60863 output parsing refactored;
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
   504
listFilesReader
1eefc3a60863 output parsing refactored;
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
   505
    |reader|
1eefc3a60863 output parsing refactored;
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
   506
1eefc3a60863 output parsing refactored;
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
   507
    reader := ArchiverOutputParser new.
1eefc3a60863 output parsing refactored;
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
   508
    reader archiver:self.
1eefc3a60863 output parsing refactored;
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
   509
    ^ reader
1085
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   510
! !
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   511
1255
32e0aa97ae82 gzip archiver stuff fixed.
Claus Gittinger <cg@exept.de>
parents: 1247
diff changeset
   512
!Archiver methodsFor:'command strings'!
32e0aa97ae82 gzip archiver stuff fixed.
Claus Gittinger <cg@exept.de>
parents: 1247
diff changeset
   513
32e0aa97ae82 gzip archiver stuff fixed.
Claus Gittinger <cg@exept.de>
parents: 1247
diff changeset
   514
addDoubleQuotedFilenames:collectionOfFilenames toStream:aStream
32e0aa97ae82 gzip archiver stuff fixed.
Claus Gittinger <cg@exept.de>
parents: 1247
diff changeset
   515
    collectionOfFilenames notNil ifTrue:[
1591
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
   516
        collectionOfFilenames do:[:el | 
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
   517
            aStream nextPutAll:' "'.
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
   518
            aStream nextPutAll:(el asString).
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
   519
            aStream nextPutAll:'"'
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
   520
        ].
1255
32e0aa97ae82 gzip archiver stuff fixed.
Claus Gittinger <cg@exept.de>
parents: 1247
diff changeset
   521
    ].
32e0aa97ae82 gzip archiver stuff fixed.
Claus Gittinger <cg@exept.de>
parents: 1247
diff changeset
   522
! !
32e0aa97ae82 gzip archiver stuff fixed.
Claus Gittinger <cg@exept.de>
parents: 1247
diff changeset
   523
1085
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   524
!Archiver methodsFor:'initialization & release'!
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   525
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   526
release
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   527
    self stopProcess.
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   528
    self removeTemporaryDirectory.
3186
c2a5877276d8 class: Archiver
Claus Gittinger <cg@exept.de>
parents: 3027
diff changeset
   529
    super release
1085
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   530
! !
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   531
1383
527dcd29a97b added ar-archive (unix object-libraries)
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
   532
!Archiver::MultiFileArchive methodsFor:'actions'!
527dcd29a97b added ar-archive (unix object-libraries)
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
   533
527dcd29a97b added ar-archive (unix object-libraries)
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
   534
addFilesToArchive:colOfFiles
1798
74535804fe1b better error handling when zip command is not installed
boris
parents: 1795
diff changeset
   535
    |cmd tempDir archivFile archivInTemp fileSize backupFile result|
1383
527dcd29a97b added ar-archive (unix object-libraries)
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
   536
527dcd29a97b added ar-archive (unix object-libraries)
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
   537
    archivFile := self fileName.
527dcd29a97b added ar-archive (unix object-libraries)
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
   538
527dcd29a97b added ar-archive (unix object-libraries)
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
   539
    tempDir := self temporaryDirectory.
527dcd29a97b added ar-archive (unix object-libraries)
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
   540
    archivInTemp := tempDir construct:(archivFile baseName).
527dcd29a97b added ar-archive (unix object-libraries)
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
   541
1784
f90c4d7528c7 *** empty log message ***
boris
parents: 1783
diff changeset
   542
    "/ copy a non-empty archiv to tempDir
f90c4d7528c7 *** empty log message ***
boris
parents: 1783
diff changeset
   543
    fileSize := archivFile fileSize.
f90c4d7528c7 *** empty log message ***
boris
parents: 1783
diff changeset
   544
    (fileSize notNil and: [fileSize > 0])
f90c4d7528c7 *** empty log message ***
boris
parents: 1783
diff changeset
   545
      ifTrue: [archivFile copyTo:archivInTemp].
f90c4d7528c7 *** empty log message ***
boris
parents: 1783
diff changeset
   546
1383
527dcd29a97b added ar-archive (unix object-libraries)
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
   547
    "/ keep a save copy
1784
f90c4d7528c7 *** empty log message ***
boris
parents: 1783
diff changeset
   548
1799
5bb8bb7d430f creation of .sav file modified
boris
parents: 1798
diff changeset
   549
"/    backupFile := archivFile withSuffix: 'sav'.
5bb8bb7d430f creation of .sav file modified
boris
parents: 1798
diff changeset
   550
"/    (backupFile exists) ifTrue:[
5bb8bb7d430f creation of .sav file modified
boris
parents: 1798
diff changeset
   551
"/          backupFile recursiveRemove. " works for a file as well as for a directory " 
5bb8bb7d430f creation of .sav file modified
boris
parents: 1798
diff changeset
   552
"/    ].
1795
e52a638e2a81 deletion of an old *.sav file fixed
boris
parents: 1784
diff changeset
   553
1799
5bb8bb7d430f creation of .sav file modified
boris
parents: 1798
diff changeset
   554
"/    archivFile renameTo:(archivFile withSuffix:'sav').
1795
e52a638e2a81 deletion of an old *.sav file fixed
boris
parents: 1784
diff changeset
   555
1383
527dcd29a97b added ar-archive (unix object-libraries)
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
   556
    [
1591
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
   557
        "/ copy files to be added to tempDir
1784
f90c4d7528c7 *** empty log message ***
boris
parents: 1783
diff changeset
   558
        colOfFiles do:[:file | | destName |
f90c4d7528c7 *** empty log message ***
boris
parents: 1783
diff changeset
   559
            destName := tempDir construct:(file asFilename baseName).
f90c4d7528c7 *** empty log message ***
boris
parents: 1783
diff changeset
   560
            file isDirectory
f90c4d7528c7 *** empty log message ***
boris
parents: 1783
diff changeset
   561
              ifTrue: [destName := tempDir]. 
f90c4d7528c7 *** empty log message ***
boris
parents: 1783
diff changeset
   562
            file recursiveCopyTo:destName.
1591
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
   563
        ].
1383
527dcd29a97b added ar-archive (unix object-libraries)
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
   564
1798
74535804fe1b better error handling when zip command is not installed
boris
parents: 1795
diff changeset
   565
        "/ addFiles to the archive. Synchron command execution answers
74535804fe1b better error handling when zip command is not installed
boris
parents: 1795
diff changeset
   566
        "/ a boolean.
1591
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
   567
        cmd := self getCommandToAdd:colOfFiles toArchive:archivInTemp.
2646
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
   568
        cmd isNil ifTrue:[
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
   569
            errorStream nextPutAll:'No command to add files.'.
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
   570
            result := false
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
   571
        ] ifFalse:[
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
   572
            result := self executeCommand:cmd directory:tempDir.
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
   573
        ].
1383
527dcd29a97b added ar-archive (unix object-libraries)
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
   574
1798
74535804fe1b better error handling when zip command is not installed
boris
parents: 1795
diff changeset
   575
        "/ copy the archive back
74535804fe1b better error handling when zip command is not installed
boris
parents: 1795
diff changeset
   576
        (result == true and: [archivInTemp exists]) ifTrue:[
74535804fe1b better error handling when zip command is not installed
boris
parents: 1795
diff changeset
   577
            archivInTemp copyTo:archivFile.
74535804fe1b better error handling when zip command is not installed
boris
parents: 1795
diff changeset
   578
        ].
1383
527dcd29a97b added ar-archive (unix object-libraries)
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
   579
    ] ensure:[
1591
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
   580
        "/ cg: remove the tempFile
1798
74535804fe1b better error handling when zip command is not installed
boris
parents: 1795
diff changeset
   581
        archivInTemp exists ifTrue:[ archivInTemp remove.].
1591
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
   582
        "/ cg: remove copied files
1784
f90c4d7528c7 *** empty log message ***
boris
parents: 1783
diff changeset
   583
       " colOfFiles do:[:file |
1591
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
   584
            (tempDir construct:(file asFilename baseName)) remove.
1784
f90c4d7528c7 *** empty log message ***
boris
parents: 1783
diff changeset
   585
        ]. "
1783
c7c8d7faccc0 two fixes: creation of a new zip-file is now possible
boris
parents: 1591
diff changeset
   586
        "/ boris: remove the temporary directory and its name, too.
1784
f90c4d7528c7 *** empty log message ***
boris
parents: 1783
diff changeset
   587
        tempDir recursiveRemove.
1783
c7c8d7faccc0 two fixes: creation of a new zip-file is now possible
boris
parents: 1591
diff changeset
   588
        temporaryDirectory := nil.
1798
74535804fe1b better error handling when zip command is not installed
boris
parents: 1795
diff changeset
   589
    ].
1784
f90c4d7528c7 *** empty log message ***
boris
parents: 1783
diff changeset
   590
1798
74535804fe1b better error handling when zip command is not installed
boris
parents: 1795
diff changeset
   591
    ^result == true.
2646
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
   592
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
   593
    "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
   594
!
527dcd29a97b added ar-archive (unix object-libraries)
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
   595
527dcd29a97b added ar-archive (unix object-libraries)
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
   596
extractFiles:aColOfFilesOrNil to:aDirectory
527dcd29a97b added ar-archive (unix object-libraries)
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
   597
    |execDir cmd|
527dcd29a97b added ar-archive (unix object-libraries)
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
   598
527dcd29a97b added ar-archive (unix object-libraries)
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
   599
    execDir := self fileName directory.
527dcd29a97b added ar-archive (unix object-libraries)
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
   600
    cmd := self getCommandToExtractFiles:aColOfFilesOrNil intoDirectory:aDirectory.
2646
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
   601
    cmd isNil ifTrue:[
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
   602
        errorStream nextPutAll:'No command to extract files.'.
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
   603
        ^ self.
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
   604
    ].
1383
527dcd29a97b added ar-archive (unix object-libraries)
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
   605
    self executeCommand:cmd directory:execDir.
2646
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
   606
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
   607
    "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
   608
!
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
extractFiles:aColOfFiles withoutDirectoryTo:aDirectory
527dcd29a97b added ar-archive (unix object-libraries)
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
   611
    |execDir tempDir tempFile targetFile|
527dcd29a97b added ar-archive (unix object-libraries)
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
   612
527dcd29a97b added ar-archive (unix object-libraries)
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
   613
    execDir := self fileName directory.
527dcd29a97b added ar-archive (unix object-libraries)
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
   614
    tempDir := self temporaryDirectory.
527dcd29a97b added ar-archive (unix object-libraries)
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
   615
    self extractFiles:aColOfFiles to:tempDir.
527dcd29a97b added ar-archive (unix object-libraries)
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
   616
527dcd29a97b added ar-archive (unix object-libraries)
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
   617
    aColOfFiles do:[ : aFileString |
1591
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
   618
        tempFile := self temporaryDirectory construct:aFileString.
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
   619
        targetFile := aDirectory construct:(aFileString asFilename baseName).
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
   620
        targetFile exists ifTrue:[
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
   621
            targetFile recursiveRemove.
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
   622
        ].
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
   623
        tempFile exists ifTrue:[
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
   624
            tempFile recursiveCopyTo:targetFile.
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
   625
        ].
1383
527dcd29a97b added ar-archive (unix object-libraries)
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
   626
    ].
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
527dcd29a97b added ar-archive (unix object-libraries)
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
   629
removeFilesFromArchive:aColOfFiles
527dcd29a97b added ar-archive (unix object-libraries)
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
   630
527dcd29a97b added ar-archive (unix object-libraries)
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
   631
    |cmd|
527dcd29a97b added ar-archive (unix object-libraries)
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
   632
527dcd29a97b added ar-archive (unix object-libraries)
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
   633
    cmd := self getCommandToRemoveFiles:aColOfFiles.
2646
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
   634
    cmd isNil ifTrue:[
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
   635
        errorStream nextPutAll:'No command to remove files.'.
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
   636
        ^ self.
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
   637
    ].
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
   638
    self executeCommand:cmd directory:(self fileName directory).
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
   639
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
   640
    "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
   641
! !
527dcd29a97b added ar-archive (unix object-libraries)
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
   642
527dcd29a97b added ar-archive (unix object-libraries)
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
   643
!Archiver::MultiFileArchive methodsFor:'command strings'!
527dcd29a97b added ar-archive (unix object-libraries)
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
   644
527dcd29a97b added ar-archive (unix object-libraries)
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
   645
getCommandToAdd:colOfFiles toArchive:archivIn
527dcd29a97b added ar-archive (unix object-libraries)
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
   646
    self subclassResponsibility
527dcd29a97b added ar-archive (unix object-libraries)
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
   647
!
527dcd29a97b added ar-archive (unix object-libraries)
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
   648
527dcd29a97b added ar-archive (unix object-libraries)
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
   649
getCommandToExtractFiles:sel intoDirectory:dir
527dcd29a97b added ar-archive (unix object-libraries)
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
   650
    self subclassResponsibility
527dcd29a97b added ar-archive (unix object-libraries)
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
   651
!
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
getCommandToListFiles:aColOfFiles
527dcd29a97b added ar-archive (unix object-libraries)
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
   654
    self subclassResponsibility
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
527dcd29a97b added ar-archive (unix object-libraries)
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
   657
getCommandToRemoveFiles:aColOfFiles
527dcd29a97b added ar-archive (unix object-libraries)
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
   658
    self subclassResponsibility
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
1246
1eefc3a60863 output parsing refactored;
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
   661
!Archiver::ArchiverOutputParser class methodsFor:'instance creation'!
1eefc3a60863 output parsing refactored;
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
   662
1eefc3a60863 output parsing refactored;
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
   663
new
1eefc3a60863 output parsing refactored;
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
   664
    ^ self basicNew initialize.
1eefc3a60863 output parsing refactored;
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
   665
! !
1eefc3a60863 output parsing refactored;
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
   666
1eefc3a60863 output parsing refactored;
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
   667
!Archiver::ArchiverOutputParser methodsFor:'accessing'!
1eefc3a60863 output parsing refactored;
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
   668
1eefc3a60863 output parsing refactored;
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
   669
archiver:something
1eefc3a60863 output parsing refactored;
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
   670
    "set the value of the instance variable 'archiver' (automatically generated)"
1eefc3a60863 output parsing refactored;
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
   671
1eefc3a60863 output parsing refactored;
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
   672
    archiver := something.
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
1eefc3a60863 output parsing refactored;
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
   675
!Archiver::ArchiverOutputParser methodsFor:'initialization'!
1086
2af5aca23dba zip added
penk
parents: 1085
diff changeset
   676
1246
1eefc3a60863 output parsing refactored;
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
   677
initialize
1eefc3a60863 output parsing refactored;
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
   678
    firstLineRead := false.
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
1eefc3a60863 output parsing refactored;
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
   681
!Archiver::ArchiverOutputParser methodsFor:'parsing'!
1eefc3a60863 output parsing refactored;
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
   682
3436
349eb5e4cb79 class: Archiver
Claus Gittinger <cg@exept.de>
parents: 3222
diff changeset
   683
parseLine:lineIn forItemClass:itemClass
349eb5e4cb79 class: Archiver
Claus Gittinger <cg@exept.de>
parents: 3222
diff changeset
   684
    |words archiverColumns item index key line|
1246
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
    (firstLineRead not and:[archiver class hasTitleLine]) ifTrue:[
1591
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
   687
        firstLineRead := true.
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
   688
        ^ nil.
1246
1eefc3a60863 output parsing refactored;
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
   689
    ].
1eefc3a60863 output parsing refactored;
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
   690
3436
349eb5e4cb79 class: Archiver
Claus Gittinger <cg@exept.de>
parents: 3222
diff changeset
   691
    line := OperatingSystem decodePathOrCommandOutput:lineIn.
349eb5e4cb79 class: Archiver
Claus Gittinger <cg@exept.de>
parents: 3222
diff changeset
   692
1246
1eefc3a60863 output parsing refactored;
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
   693
    (archiver isValidOutputLine:line) ifFalse:[
1591
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
   694
        ^ nil.
1246
1eefc3a60863 output parsing refactored;
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
   695
    ].
1eefc3a60863 output parsing refactored;
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
   696
1eefc3a60863 output parsing refactored;
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
   697
    words := line asCollectionOfWords.
1eefc3a60863 output parsing refactored;
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
   698
    archiverColumns := archiver columns.
1eefc3a60863 output parsing refactored;
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
   699
    item := itemClass new.
1eefc3a60863 output parsing refactored;
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
   700
    index := 1.
1086
2af5aca23dba zip added
penk
parents: 1085
diff changeset
   701
1246
1eefc3a60863 output parsing refactored;
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
   702
    archiverColumns do:[:colDescr |
4315
d14a71b89af8 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4249
diff changeset
   703
        | itemWordCount itemStream itemFieldSelector |
1246
1eefc3a60863 output parsing refactored;
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
   704
1591
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
   705
        itemWordCount := colDescr second.
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
   706
        itemFieldSelector := colDescr first.
4315
d14a71b89af8 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4249
diff changeset
   707
1591
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
   708
        itemStream := WriteStream on:''.
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
   709
        itemWordCount == #rest ifTrue:[
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
   710
            words from:index do:[:w|
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
   711
                itemStream nextPutAll:w.
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
   712
                itemStream space.
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
   713
            ].
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
   714
        ] ifFalse:[
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
   715
            words from:index to:(index + itemWordCount - 1) do:[:w|
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
   716
                itemStream nextPutAll:w.
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
   717
                itemStream space.
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
   718
            ].
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
   719
            index := index + itemWordCount.
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
   720
        ].
4315
d14a71b89af8 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4249
diff changeset
   721
        itemFieldSelector notNil ifTrue:[
d14a71b89af8 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4249
diff changeset
   722
            |itemWriter|
d14a71b89af8 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4249
diff changeset
   723
d14a71b89af8 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4249
diff changeset
   724
            itemWriter := itemFieldSelector asMutator.
1591
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
   725
            item perform:itemWriter with:(itemStream contents withoutSeparators).
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
   726
        ].
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
   727
        itemStream close.
1246
1eefc3a60863 output parsing refactored;
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
   728
    ].
1eefc3a60863 output parsing refactored;
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
   729
    ((archiverColumns collect:[:el| el first]) includes:#permissions) ifTrue:[
1591
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
   730
        (item permissions startsWith:$d) ifTrue:[
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
   731
            key := #directory.
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
   732
            item isDirectory:true.
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
   733
        ] ifFalse:[
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
   734
            key := MIMETypes mimeTypeForFilename:(item fileName asFilename baseName).
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
   735
            item isDirectory:false.
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
   736
        ].
1246
1eefc3a60863 output parsing refactored;
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
   737
    ] ifFalse:[
1591
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
   738
        key := MIMETypes mimeTypeForFilename:(item fileName asFilename baseName).
1246
1eefc3a60863 output parsing refactored;
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
   739
    ].
3222
bb50c5b07f96 Do not refer to FileBrowser methods
Stefan Vogel <sv@exept.de>
parents: 3206
diff changeset
   740
    item icon:(MIMETypeIconLibrary iconForKeyMatching:key).
1246
1eefc3a60863 output parsing refactored;
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
   741
    ^ item
4315
d14a71b89af8 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4249
diff changeset
   742
d14a71b89af8 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4249
diff changeset
   743
    "Modified: / 10-02-2017 / 14:51:54 / cg"
1086
2af5aca23dba zip added
penk
parents: 1085
diff changeset
   744
! !
2af5aca23dba zip added
penk
parents: 1085
diff changeset
   745
1392
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   746
!Archiver::CompressedFile class methodsFor:'command strings'!
1215
c3fe5597c1ec refactored
Claus Gittinger <cg@exept.de>
parents: 1205
diff changeset
   747
1392
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   748
compressCommand
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   749
    self subclassResponsibility
1215
c3fe5597c1ec refactored
Claus Gittinger <cg@exept.de>
parents: 1205
diff changeset
   750
!
c3fe5597c1ec refactored
Claus Gittinger <cg@exept.de>
parents: 1205
diff changeset
   751
1392
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   752
uncompressCommand
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   753
    self subclassResponsibility
1215
c3fe5597c1ec refactored
Claus Gittinger <cg@exept.de>
parents: 1205
diff changeset
   754
! !
c3fe5597c1ec refactored
Claus Gittinger <cg@exept.de>
parents: 1205
diff changeset
   755
1392
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   756
!Archiver::CompressedFile class methodsFor:'queries'!
1086
2af5aca23dba zip added
penk
parents: 1085
diff changeset
   757
1106
893c2c508df1 checkin from browser
penk
parents: 1098
diff changeset
   758
canViewFile
893c2c508df1 checkin from browser
penk
parents: 1098
diff changeset
   759
893c2c508df1 checkin from browser
penk
parents: 1098
diff changeset
   760
    ^ true
1086
2af5aca23dba zip added
penk
parents: 1085
diff changeset
   761
! !
2af5aca23dba zip added
penk
parents: 1085
diff changeset
   762
1392
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   763
!Archiver::CompressedFile methodsFor:'actions'!
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   764
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   765
compressFile:aFile to:newFile
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   766
    | cmd directory|
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   767
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   768
    directory := newFile directory.
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   769
    (directory exists) ifFalse:[
2086
4ffc55b2f921 self warn
Claus Gittinger <cg@exept.de>
parents: 2040
diff changeset
   770
        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
   771
    ].
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   772
    (directory isDirectory) ifFalse:[
2086
4ffc55b2f921 self warn
Claus Gittinger <cg@exept.de>
parents: 2040
diff changeset
   773
        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
   774
    ].
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
    cmd := self getCommandToCompress:aFile asNew:newFile.
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   777
    self executeCommand:cmd directory:directory.
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   778
    newFile exists ifTrue:[
1591
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
   779
        self fileName:newFile.
1392
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   780
    ].
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   781
!
1085
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   782
1215
c3fe5597c1ec refactored
Claus Gittinger <cg@exept.de>
parents: 1205
diff changeset
   783
extractFiles:aColOfFilesOrNil to:aDirectory
1392
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   784
    self uncompressTo:aDirectory
1106
893c2c508df1 checkin from browser
penk
parents: 1098
diff changeset
   785
!
893c2c508df1 checkin from browser
penk
parents: 1098
diff changeset
   786
1392
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   787
uncompressTo:aDirectory
1085
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   788
    | cmd file newFile|
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   789
1392
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   790
    (aDirectory exists) ifFalse:[
2086
4ffc55b2f921 self warn
Claus Gittinger <cg@exept.de>
parents: 2040
diff changeset
   791
        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
   792
        ^ self
1085
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   793
    ].
1392
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   794
    (aDirectory isDirectory) ifFalse:[
2086
4ffc55b2f921 self warn
Claus Gittinger <cg@exept.de>
parents: 2040
diff changeset
   795
        self warn:'Cannot uncompress to file ', aDirectory asString.
1591
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
   796
        ^ self
1085
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   797
    ].
1215
c3fe5597c1ec refactored
Claus Gittinger <cg@exept.de>
parents: 1205
diff changeset
   798
    file := newFile := self fileName.
c3fe5597c1ec refactored
Claus Gittinger <cg@exept.de>
parents: 1205
diff changeset
   799
    (file directory pathName = aDirectory pathName) ifFalse:[
1591
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
   800
        newFile := aDirectory construct:(file baseName).
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
   801
        file copyTo:newFile.
1085
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   802
    ].
1392
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   803
    cmd := self getCommandToUncompress:newFile.
1591
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
   804
    self executeCommand:cmd directory:aDirectory. 
1392
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   805
! !
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   806
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   807
!Archiver::CompressedFile methodsFor:'columns'!
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   808
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   809
columns
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   810
    self subclassResponsibility
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   811
!
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   812
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   813
isValidOutputLine:line
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   814
    ^ line endsWith:self fileName withoutSuffix baseName.
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   815
! !
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
!Archiver::CompressedFile methodsFor:'command strings'!
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   818
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   819
getCommandToCompress:aFile asNew:newFile
1591
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
   820
    ^ '%1 -c %2 > %3' 
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
   821
        bindWith:self class compressCommand
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
   822
        with:aFile asString 
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
   823
        with:newFile asString
1392
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   824
!
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   825
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   826
getCommandToListFiles:dummyArg
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   827
    ^ 'gzip -l "' , self fileName baseName , '"'
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   828
!
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   829
1591
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
   830
getCommandToUncompress:aFileName 
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
   831
    ^ '%1 %2' 
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
   832
        bindWith:self class uncompressCommand
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
   833
        with:aFileName baseName
1392
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   834
! !
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   835
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   836
!Archiver::BZ2Compressed class methodsFor:'command strings'!
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   837
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   838
compressCommand
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   839
    ^ 'bzip2'
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   840
!
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   841
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   842
uncompressCommand
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   843
    ^ 'bunzip2'
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   844
! !
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
!Archiver::BZ2Compressed methodsFor:'columns'!
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   847
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   848
columns
1591
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
   849
    ^ #(      
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
   850
         #(#fileName        1)
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
   851
    ) 
1392
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
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   854
isValidOutputLine:line
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   855
    ^ true
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   856
! !
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   857
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   858
!Archiver::BZ2Compressed methodsFor:'command strings'!
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   859
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   860
getCommandToListFiles:dummyArg
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   861
    ^ 'echo ' , self fileName withoutSuffix baseName
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   862
"/    ^ 'bzip2 -t -v "' , self fileName baseName , '"'
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
!Archiver::CompressedTarArchive class methodsFor:'queries'!
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   866
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   867
canAddFiles
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   868
    ^ Archiver tarArchive canAddFiles
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   869
!
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   870
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   871
canRemoveFiles
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   872
    ^ Archiver tarArchive canRemoveFiles
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   873
!
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
canViewFile
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   876
    ^ Archiver tarArchive canViewFile
1085
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   877
!
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   878
1392
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   879
compressorClass
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   880
    self subclassResponsibility
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
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   883
!Archiver::CompressedTarArchive methodsFor:'accessing'!
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
fileName:aFile
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   886
    |tempDir file compressor suffix tarFilename|
1085
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   887
1392
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   888
    super fileName:aFile.
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   889
    " 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
   890
    tempDir := self temporaryDirectory.
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   891
    compressor := (self class compressorClass) with:(self fileName).
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   892
    compressor uncompressTo:tempDir.
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   893
    suffix := self fileName suffix.
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   894
    file := self fileName withoutSuffix.
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   895
    tarFilename := file baseName.
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   896
    file suffix ~= 'tar' ifTrue:[
1591
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
   897
        tarFilename := tarFilename , '.tar'
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
    tarFile := self temporaryDirectory construct:tarFilename.
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   900
    tarArchiver := Archiver::TarArchive with:tarFile.
1085
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   901
! !
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
   902
1392
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   903
!Archiver::CompressedTarArchive methodsFor:'actions'!
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   904
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   905
addFilesToArchive:colOfFiles
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   906
    self setCommandOptions.
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   907
    tarArchiver addFilesToArchive:colOfFiles.
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   908
    "/ 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
   909
    self synchronize.
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   910
!
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   911
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   912
extractFiles:aColOfFiles to:aDirectory
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   913
    self setCommandOptions.
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   914
    tarArchiver extractFiles:aColOfFiles to:aDirectory.
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
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   917
extractFiles:aColOfFiles withoutDirectoryTo:aDirectory
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   918
    self setCommandOptions.
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   919
    tarArchiver extractFiles:aColOfFiles withoutDirectoryTo:aDirectory.
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   920
!
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
listFiles:aColOfFiles
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   923
    self setCommandOptions.
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   924
    tarArchiver listFiles:aColOfFiles.
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   925
!
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
removeFilesFromArchive:aColOfFiles
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   928
    self setCommandOptions.
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   929
    tarArchiver removeFilesFromArchive:aColOfFiles.
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   930
    self synchronize.
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
!Archiver::CompressedTarArchive methodsFor:'actions private'!
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   934
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   935
setCommandOptions
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   936
    tarArchiver outStream:(self outStream).
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   937
    tarArchiver errorStream:(self errorStream).
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   938
    tarArchiver synchron:(self synchron).
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   939
!
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   940
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   941
synchronize
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   942
    self subclassResponsibility
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
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   945
!Archiver::CompressedTarArchive methodsFor:'columns'!
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   946
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   947
columns
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   948
    ^ tarArchiver columns
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   949
!
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
isValidOutputLine:line
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   952
    ^ tarArchiver isValidOutputLine:line
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   953
! !
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   954
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   955
!Archiver::CompressedTarArchive methodsFor:'initialization & release'!
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   956
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   957
release
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   958
    super release.
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   959
    tarArchiver release.
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
!Archiver::GZipCompressed class methodsFor:'command strings'!
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   963
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   964
compressCommand
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   965
    ^ 'gzip'
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   966
!
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   967
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   968
uncompressCommand
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   969
    ^ 'gunzip'
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   970
! !
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
!Archiver::GZipCompressed class methodsFor:'queries'!
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   973
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   974
hasTitleLine
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   975
    ^ true
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   976
! !
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   977
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   978
!Archiver::GZipCompressed methodsFor:'columns'!
1246
1eefc3a60863 output parsing refactored;
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
   979
1eefc3a60863 output parsing refactored;
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
   980
columns
1eefc3a60863 output parsing refactored;
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
   981
1eefc3a60863 output parsing refactored;
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
   982
    "/ columns in stream order
1247
4c628a0455c1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1246
diff changeset
   983
    "/  colums id/readSelector          words to read
1591
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
   984
    ^ #( "/ #(#method          1)      
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
   985
         "/ #(#crc             1)    
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
   986
         "/ #(#dateAndTime     3)   
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
   987
         #(#compressSize    1)  
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
   988
         #(#size            1) 
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
   989
         #(#ratio           1) 
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
   990
         #(#fileName        #rest)
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
   991
    ) 
1255
32e0aa97ae82 gzip archiver stuff fixed.
Claus Gittinger <cg@exept.de>
parents: 1247
diff changeset
   992
!
32e0aa97ae82 gzip archiver stuff fixed.
Claus Gittinger <cg@exept.de>
parents: 1247
diff changeset
   993
32e0aa97ae82 gzip archiver stuff fixed.
Claus Gittinger <cg@exept.de>
parents: 1247
diff changeset
   994
isValidOutputLine:line
32e0aa97ae82 gzip archiver stuff fixed.
Claus Gittinger <cg@exept.de>
parents: 1247
diff changeset
   995
    ^ line endsWith:self fileName withoutSuffix baseName.
1246
1eefc3a60863 output parsing refactored;
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
   996
! !
1eefc3a60863 output parsing refactored;
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
   997
1392
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
   998
!Archiver::GZipCompressed methodsFor:'command strings'!
1255
32e0aa97ae82 gzip archiver stuff fixed.
Claus Gittinger <cg@exept.de>
parents: 1247
diff changeset
   999
32e0aa97ae82 gzip archiver stuff fixed.
Claus Gittinger <cg@exept.de>
parents: 1247
diff changeset
  1000
getCommandToListFiles:dummyArg
32e0aa97ae82 gzip archiver stuff fixed.
Claus Gittinger <cg@exept.de>
parents: 1247
diff changeset
  1001
    ^ 'gzip -l "' , self fileName baseName , '"'
1215
c3fe5597c1ec refactored
Claus Gittinger <cg@exept.de>
parents: 1205
diff changeset
  1002
! !
c3fe5597c1ec refactored
Claus Gittinger <cg@exept.de>
parents: 1205
diff changeset
  1003
4584
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1004
!Archiver::LZipArchive class methodsFor:'command strings'!
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1005
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1006
unzipCommand
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1007
    ^ 'lzip'
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1008
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1009
    "
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1010
     self unzipCommand    
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1011
    "
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1012
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1013
    "Modified: / 16-09-2011 / 17:26:18 / cg"
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1014
!
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1015
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1016
zipCommand
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1017
    ^ self unzipCommand.
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1018
! !
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
!Archiver::LZipArchive class methodsFor:'queries'!
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1021
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1022
canAddFiles
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
    ^ true
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
canRemoveFiles
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1028
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1029
    ^ true
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1030
!
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1031
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1032
canViewFile
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1033
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1034
    ^ true
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1035
!
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
hasLastLine
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1038
    ^ true
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
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1041
hasTitleLine
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1042
    ^ true
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1043
! !
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1044
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1045
!Archiver::LZipArchive methodsFor:'columns'!
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
columns
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1048
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1049
    "/  colums id/readSelector    words to read
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1050
    ^ #( (#uncompressed    2)      
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1051
         (#memb            1)    
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1052
         (#trail           1)     
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1053
         (#uncompressed    1)    
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1054
         (#compressed      1)    
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1055
         (saved            1)  
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1056
         (#fileName        #rest)
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1057
    ) 
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1058
!
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1059
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1060
isValidOutputLine:line
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1061
    ^ true.
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1062
! !
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1063
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1064
!Archiver::LZipArchive methodsFor:'command strings'!
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1065
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1066
getCommandToExtractFiles:aColOfFiles intoDirectory:dir
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1067
    |cmd template|
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
    cmd := self class unzipCommand.
4637
1d8bc0d9423a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4584
diff changeset
  1070
4584
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1071
    OperatingSystem isUNIXlike ifTrue:[
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1072
        template := '%1 -o -d "%2" "%3"'
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
    OperatingSystem isMSDOSlike ifTrue:[
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1075
        self halt:'unhandled os'.
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
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1078
    template notNil ifTrue:[
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1079
        ^ String streamContents:[:s |
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1080
            "/ -o   UnzipOverwriteExistingFilesOption
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1081
            "/ -d   UnzipExtDirectoryOption
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1082
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1083
            s nextPutAll:(template 
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1084
                    bindWith:cmd
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1085
                    with:dir asString string
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1086
                    with:self fileName asString).
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
            self addDoubleQuotedFilenames:aColOfFiles toStream:s.
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1089
        ]
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1090
    ].
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1091
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1092
    ^ nil.
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
    "Modified: / 16-09-2011 / 16:38:57 / cg"
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1095
!
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1096
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1097
getCommandToListFiles:aColOfFiles 
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1098
    |cmd template|
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1099
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1100
    cmd := self class unzipCommand.
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
    OperatingSystem isUNIXlike ifTrue:[
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1103
        "/  -l      list
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1104
        template := '"%1" -l "%2"'
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1105
    ].
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1106
    OperatingSystem isMSDOSlike ifTrue:[
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1107
        self error:'unsupported'
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1108
    ].
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1109
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1110
    template notNil ifTrue:[
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1111
        ^ String streamContents:[:s |
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1112
            s nextPutAll:(template 
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1113
                            bindWith:cmd with:self fileName asString string).
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1114
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1115
            aColOfFiles notNil ifTrue:[       
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1116
                self breakPoint:#ca.
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1117
                self 
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1118
                    addDoubleQuotedFilenames:(aColOfFiles collect:[:each | each asFilename baseName])
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1119
                    toStream:s.
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
        ].
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1122
    ].
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1123
    ^ nil.
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1124
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1125
    "Modified: / 29-11-2011 / 20:19:18 / cg"
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1126
!
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1127
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1128
getCommandToRemoveFiles:aColOfFiles 
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1129
    ^ nil.
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1130
bb1b80fa1cdd #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4559
diff changeset
  1131
    "Modified: / 16-09-2011 / 16:29:09 / cg"
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
1383
527dcd29a97b added ar-archive (unix object-libraries)
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
  1134
!Archiver::ArArchive class methodsFor:'command strings'!
1215
c3fe5597c1ec refactored
Claus Gittinger <cg@exept.de>
parents: 1205
diff changeset
  1135
1383
527dcd29a97b added ar-archive (unix object-libraries)
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
  1136
arCommand
527dcd29a97b added ar-archive (unix object-libraries)
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
  1137
    ^ 'ar'
527dcd29a97b added ar-archive (unix object-libraries)
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
  1138
! !
527dcd29a97b added ar-archive (unix object-libraries)
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
  1139
527dcd29a97b added ar-archive (unix object-libraries)
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
  1140
!Archiver::ArArchive methodsFor:'columns'!
1215
c3fe5597c1ec refactored
Claus Gittinger <cg@exept.de>
parents: 1205
diff changeset
  1141
1383
527dcd29a97b added ar-archive (unix object-libraries)
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
  1142
columns
527dcd29a97b added ar-archive (unix object-libraries)
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
  1143
    "/  colums id/readSelector words to read
1591
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
  1144
    ^ #( 
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
  1145
         #(#permissions     1)      
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
  1146
         #(#ownerGroup      1)    
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
  1147
         #(#size            1)   
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
  1148
         #(#monthName       1)  
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
  1149
         #(#dayString       1)  
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
  1150
         #(#timeString      1)  
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
  1151
         #(#yearString      1)  
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
  1152
         #(#fileName        #rest)
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
  1153
    ) 
1085
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
  1154
!
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
  1155
1383
527dcd29a97b added ar-archive (unix object-libraries)
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
  1156
isValidOutputLine:line
527dcd29a97b added ar-archive (unix object-libraries)
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
  1157
    ('[-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
  1158
    ^ false.
527dcd29a97b added ar-archive (unix object-libraries)
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
  1159
! !
1215
c3fe5597c1ec refactored
Claus Gittinger <cg@exept.de>
parents: 1205
diff changeset
  1160
1383
527dcd29a97b added ar-archive (unix object-libraries)
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
  1161
!Archiver::ArArchive methodsFor:'command strings'!
527dcd29a97b added ar-archive (unix object-libraries)
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
  1162
1591
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
  1163
getCommandToExtractFiles:sel intoDirectory:dir 
1383
527dcd29a97b added ar-archive (unix object-libraries)
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
  1164
    |stream|
1215
c3fe5597c1ec refactored
Claus Gittinger <cg@exept.de>
parents: 1205
diff changeset
  1165
1383
527dcd29a97b added ar-archive (unix object-libraries)
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
  1166
    stream := WriteStream on:''.
527dcd29a97b added ar-archive (unix object-libraries)
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
  1167
527dcd29a97b added ar-archive (unix object-libraries)
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
  1168
    "/ 'x'  arArchivUnpackOption
1591
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
  1169
    stream nextPutAll:('(cd %3 ; %1 x "%2" ' 
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
  1170
                    bindWith:self class arCommand
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
  1171
                    with:self fileName asString string
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
  1172
                    with:dir asString string).
1383
527dcd29a97b added ar-archive (unix object-libraries)
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
  1173
527dcd29a97b added ar-archive (unix object-libraries)
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
  1174
    sel notNil ifTrue:[
1591
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
  1175
        sel do:[:el | 
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
  1176
            stream nextPutAll:' "'.
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
  1177
            stream nextPutAll:(el asString).
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
  1178
            stream nextPutAll:'"'
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
  1179
        ].
1215
c3fe5597c1ec refactored
Claus Gittinger <cg@exept.de>
parents: 1205
diff changeset
  1180
    ].
1384
fea5bf58e5fb allow single extract from an archive
Claus Gittinger <cg@exept.de>
parents: 1383
diff changeset
  1181
    stream nextPutAll:')'.
1383
527dcd29a97b added ar-archive (unix object-libraries)
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
  1182
    ^ stream contents.
1085
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
  1183
!
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
  1184
1591
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
  1185
getCommandToListFiles:aColOfFiles 
1383
527dcd29a97b added ar-archive (unix object-libraries)
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
  1186
    |stream|
1215
c3fe5597c1ec refactored
Claus Gittinger <cg@exept.de>
parents: 1205
diff changeset
  1187
1383
527dcd29a97b added ar-archive (unix object-libraries)
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
  1188
    stream := WriteStream on:''.
1215
c3fe5597c1ec refactored
Claus Gittinger <cg@exept.de>
parents: 1205
diff changeset
  1189
1383
527dcd29a97b added ar-archive (unix object-libraries)
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
  1190
    "/ 't'  arArchivListContentsOption
527dcd29a97b added ar-archive (unix object-libraries)
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
  1191
    "/ 'v'  arArchivVerboseOption
1591
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
  1192
    stream nextPutAll:('%1 tv "%2"' 
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
  1193
                    bindWith:self class arCommand
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
  1194
                    with:self fileName baseName).
1215
c3fe5597c1ec refactored
Claus Gittinger <cg@exept.de>
parents: 1205
diff changeset
  1195
1383
527dcd29a97b added ar-archive (unix object-libraries)
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
  1196
    stream nextPutAll:(self class stringWithQuotedFileBaseNames:aColOfFiles).
527dcd29a97b added ar-archive (unix object-libraries)
Claus Gittinger <cg@exept.de>
parents: 1334
diff changeset
  1197
    ^ stream contents.
1085
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
  1198
! !
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
  1199
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
  1200
!Archiver::TarArchive class methodsFor:'command strings'!
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
  1201
1215
c3fe5597c1ec refactored
Claus Gittinger <cg@exept.de>
parents: 1205
diff changeset
  1202
tarCommand
1085
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
  1203
    ^ 'tar'
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
  1204
! !
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
  1205
1086
2af5aca23dba zip added
penk
parents: 1085
diff changeset
  1206
!Archiver::TarArchive class methodsFor:'queries'!
2af5aca23dba zip added
penk
parents: 1085
diff changeset
  1207
2af5aca23dba zip added
penk
parents: 1085
diff changeset
  1208
canAddFiles
2af5aca23dba zip added
penk
parents: 1085
diff changeset
  1209
2af5aca23dba zip added
penk
parents: 1085
diff changeset
  1210
    ^ true
2af5aca23dba zip added
penk
parents: 1085
diff changeset
  1211
!
2af5aca23dba zip added
penk
parents: 1085
diff changeset
  1212
2af5aca23dba zip added
penk
parents: 1085
diff changeset
  1213
canRemoveFiles
2af5aca23dba zip added
penk
parents: 1085
diff changeset
  1214
2af5aca23dba zip added
penk
parents: 1085
diff changeset
  1215
    ^ true
1106
893c2c508df1 checkin from browser
penk
parents: 1098
diff changeset
  1216
!
893c2c508df1 checkin from browser
penk
parents: 1098
diff changeset
  1217
893c2c508df1 checkin from browser
penk
parents: 1098
diff changeset
  1218
canViewFile
893c2c508df1 checkin from browser
penk
parents: 1098
diff changeset
  1219
893c2c508df1 checkin from browser
penk
parents: 1098
diff changeset
  1220
    ^ true
1086
2af5aca23dba zip added
penk
parents: 1085
diff changeset
  1221
! !
2af5aca23dba zip added
penk
parents: 1085
diff changeset
  1222
1246
1eefc3a60863 output parsing refactored;
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
  1223
!Archiver::TarArchive methodsFor:'columns'!
1eefc3a60863 output parsing refactored;
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
  1224
1eefc3a60863 output parsing refactored;
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
  1225
columns
1eefc3a60863 output parsing refactored;
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
  1226
1247
4c628a0455c1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1246
diff changeset
  1227
    "/  colums id/readSelector words to read
1591
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
  1228
    ^ #( #(#permissions     1)      
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
  1229
         #(#ownerGroup      1)    
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
  1230
         #(#size            1)   
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
  1231
         #(#dateAndTime     2)  
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
  1232
         #(#fileName        #rest)
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
  1233
    ) 
1246
1eefc3a60863 output parsing refactored;
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
  1234
!
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
isValidOutputLine:line
1eefc3a60863 output parsing refactored;
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
  1237
    ('[-d][-r][-w][-x]' match:(line copyTo:4)) ifTrue:[^ true].
1eefc3a60863 output parsing refactored;
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
  1238
    ^ false.
1eefc3a60863 output parsing refactored;
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
  1239
! !
1eefc3a60863 output parsing refactored;
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
  1240
1085
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
  1241
!Archiver::TarArchive methodsFor:'command strings'!
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
  1242
1215
c3fe5597c1ec refactored
Claus Gittinger <cg@exept.de>
parents: 1205
diff changeset
  1243
getCommandToAdd:aColOfFiles toArchive:archiveFile
1174
fde4f57dce18 cleanup
Claus Gittinger <cg@exept.de>
parents: 1145
diff changeset
  1244
    |stream|
1085
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
  1245
1215
c3fe5597c1ec refactored
Claus Gittinger <cg@exept.de>
parents: 1205
diff changeset
  1246
    archiveFile exists ifFalse:[^ nil].
1174
fde4f57dce18 cleanup
Claus Gittinger <cg@exept.de>
parents: 1145
diff changeset
  1247
fde4f57dce18 cleanup
Claus Gittinger <cg@exept.de>
parents: 1145
diff changeset
  1248
    stream := WriteStream on:''.
1145
9a6688b7139a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
  1249
1174
fde4f57dce18 cleanup
Claus Gittinger <cg@exept.de>
parents: 1145
diff changeset
  1250
    "/ 'r'  TarArchivAddOption
fde4f57dce18 cleanup
Claus Gittinger <cg@exept.de>
parents: 1145
diff changeset
  1251
    "/ 'f'  TarArchivFileOption
1591
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
  1252
    stream nextPutAll:('%1 rf "%2"' 
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
  1253
                    bindWith:self class tarCommand
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
  1254
                    with:archiveFile asString string).
1145
9a6688b7139a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
  1255
1174
fde4f57dce18 cleanup
Claus Gittinger <cg@exept.de>
parents: 1145
diff changeset
  1256
    stream nextPutAll:(self class stringWithQuotedFileBaseNames:aColOfFiles).
fde4f57dce18 cleanup
Claus Gittinger <cg@exept.de>
parents: 1145
diff changeset
  1257
    ^ stream contents
1085
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
  1258
!
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
  1259
1591
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
  1260
getCommandToExtractFiles:sel intoDirectory:dir 
1174
fde4f57dce18 cleanup
Claus Gittinger <cg@exept.de>
parents: 1145
diff changeset
  1261
    |stream|
1085
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
  1262
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
  1263
    stream := WriteStream on:''.
1145
9a6688b7139a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
  1264
9a6688b7139a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
  1265
    "/ 'x'  TarArchivUnpackOption
9a6688b7139a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
  1266
    "/ 'f'  TarArchivFileOption
9a6688b7139a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
  1267
    "/ 'C'  TarArchivUnpackInDirectoryOption
4249
d70b0b1791a7 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4244
diff changeset
  1268
    stream nextPutAll:('%1 -xf "%2" -C "%3"' 
1591
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
  1269
                    bindWith:self class tarCommand
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
  1270
                    with:self fileName asString string
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
  1271
                    with:dir asString).
1145
9a6688b7139a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
  1272
1085
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
  1273
    sel notNil ifTrue:[
1591
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
  1274
        sel do:[:el | 
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
  1275
            stream nextPutAll:' "'.
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
  1276
            stream nextPutAll:(el asString).
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
  1277
            stream nextPutAll:'"'
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
  1278
        ].
1085
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
  1279
    ].
1145
9a6688b7139a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1144
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
getCommandToListFiles:aColOfFiles 
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
    "/ 't'  TarArchivListContentsOption
9a6688b7139a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
  1289
    "/ 'v'  TarArchivVerboseOption
9a6688b7139a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
  1290
    "/ 'f'  TarArchivFileOption
1591
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
  1291
    stream nextPutAll:('%1 -tvf "%2"' 
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 baseName).
1145
9a6688b7139a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
  1294
1174
fde4f57dce18 cleanup
Claus Gittinger <cg@exept.de>
parents: 1145
diff changeset
  1295
    stream nextPutAll:(self class stringWithQuotedFileBaseNames:aColOfFiles).
1145
9a6688b7139a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
  1296
    ^ stream contents.
1085
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
  1297
!
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
  1298
1591
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
  1299
getCommandToRemoveFiles:sel 
1174
fde4f57dce18 cleanup
Claus Gittinger <cg@exept.de>
parents: 1145
diff changeset
  1300
    |stream filename|
1085
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
  1301
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
  1302
    filename := self fileName.
1174
fde4f57dce18 cleanup
Claus Gittinger <cg@exept.de>
parents: 1145
diff changeset
  1303
    filename exists ifFalse:[^ nil].
1145
9a6688b7139a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
  1304
1174
fde4f57dce18 cleanup
Claus Gittinger <cg@exept.de>
parents: 1145
diff changeset
  1305
    stream := WriteStream on:''.
1145
9a6688b7139a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
  1306
1174
fde4f57dce18 cleanup
Claus Gittinger <cg@exept.de>
parents: 1145
diff changeset
  1307
    "/ 'f'  TarArchivFileOption
1591
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
  1308
    stream nextPutAll:('%1 --delete -f "%2"' 
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
  1309
                    bindWith:self class tarCommand
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
  1310
                    with:self fileName baseName).
1174
fde4f57dce18 cleanup
Claus Gittinger <cg@exept.de>
parents: 1145
diff changeset
  1311
fde4f57dce18 cleanup
Claus Gittinger <cg@exept.de>
parents: 1145
diff changeset
  1312
    stream nextPutAll:(self class stringWithQuotedFileBaseNames:sel).
fde4f57dce18 cleanup
Claus Gittinger <cg@exept.de>
parents: 1145
diff changeset
  1313
    ^ stream contents
1085
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
  1314
! !
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
  1315
1392
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
  1316
!Archiver::TarBZ2Archive class methodsFor:'queries'!
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
  1317
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
  1318
canAddFiles
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
  1319
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
  1320
    ^ Archiver tarArchive canAddFiles
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
  1321
!
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
  1322
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
  1323
canRemoveFiles
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
  1324
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
  1325
    ^ Archiver tarArchive canRemoveFiles
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
  1326
!
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
  1327
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
  1328
canViewFile
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
  1329
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
  1330
    ^ Archiver tarArchive canViewFile
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
  1331
!
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
  1332
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
  1333
compressorClass
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
  1334
    ^ Archiver::BZ2Compressed
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
  1335
! !
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
  1336
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
  1337
!Archiver::TarBZ2Archive methodsFor:'actions private'!
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
  1338
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
  1339
synchronize
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
  1340
    |gzipArchiver|
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
  1341
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
  1342
    gzipArchiver := Archiver::BZ2Compressed with:nil.
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
  1343
    gzipArchiver compressFile:(tarArchiver fileName) to:(self fileName).
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
1086
2af5aca23dba zip added
penk
parents: 1085
diff changeset
  1346
!Archiver::TarGZipArchive class methodsFor:'queries'!
2af5aca23dba zip added
penk
parents: 1085
diff changeset
  1347
2af5aca23dba zip added
penk
parents: 1085
diff changeset
  1348
canAddFiles
2af5aca23dba zip added
penk
parents: 1085
diff changeset
  1349
2af5aca23dba zip added
penk
parents: 1085
diff changeset
  1350
    ^ Archiver tarArchive canAddFiles
2af5aca23dba zip added
penk
parents: 1085
diff changeset
  1351
!
2af5aca23dba zip added
penk
parents: 1085
diff changeset
  1352
2af5aca23dba zip added
penk
parents: 1085
diff changeset
  1353
canRemoveFiles
2af5aca23dba zip added
penk
parents: 1085
diff changeset
  1354
2af5aca23dba zip added
penk
parents: 1085
diff changeset
  1355
    ^ Archiver tarArchive canRemoveFiles
1106
893c2c508df1 checkin from browser
penk
parents: 1098
diff changeset
  1356
!
893c2c508df1 checkin from browser
penk
parents: 1098
diff changeset
  1357
893c2c508df1 checkin from browser
penk
parents: 1098
diff changeset
  1358
canViewFile
893c2c508df1 checkin from browser
penk
parents: 1098
diff changeset
  1359
893c2c508df1 checkin from browser
penk
parents: 1098
diff changeset
  1360
    ^ Archiver tarArchive canViewFile
1085
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
  1361
!
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
  1362
1392
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
  1363
compressorClass
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
  1364
    ^ Archiver::GZipCompressed
1085
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
  1365
! !
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
  1366
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
  1367
!Archiver::TarGZipArchive methodsFor:'actions private'!
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
  1368
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
  1369
synchronize
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
  1370
    |gzipArchiver|
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
  1371
1392
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
  1372
    gzipArchiver := Archiver::GZipCompressed with:nil.
e5290b66715f refactored and bz2 support added
Claus Gittinger <cg@exept.de>
parents: 1384
diff changeset
  1373
    gzipArchiver compressFile:(tarArchiver fileName) to:(self fileName).
1085
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
  1374
! !
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
  1375
4103
d2f19ff163dc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
  1376
!Archiver::XarArchive class methodsFor:'command strings'!
d2f19ff163dc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
  1377
d2f19ff163dc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
  1378
xarCommand
d2f19ff163dc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
  1379
    ^ 'xar'
d2f19ff163dc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
  1380
! !
d2f19ff163dc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
  1381
d2f19ff163dc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
  1382
!Archiver::XarArchive class methodsFor:'queries'!
d2f19ff163dc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
  1383
d2f19ff163dc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
  1384
canAddFiles
d2f19ff163dc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
  1385
d2f19ff163dc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
  1386
    ^ false
d2f19ff163dc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
  1387
!
d2f19ff163dc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
  1388
d2f19ff163dc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
  1389
canRemoveFiles
d2f19ff163dc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
  1390
d2f19ff163dc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
  1391
    ^ false
d2f19ff163dc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
  1392
!
d2f19ff163dc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
  1393
d2f19ff163dc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
  1394
canViewFile
d2f19ff163dc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
  1395
d2f19ff163dc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
  1396
    ^ true
d2f19ff163dc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
  1397
! !
d2f19ff163dc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
  1398
d2f19ff163dc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
  1399
!Archiver::XarArchive methodsFor:'columns'!
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
columns
d2f19ff163dc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
  1402
d2f19ff163dc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
  1403
    "/  colums id/readSelector words to read
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
         #(#fileName        #rest)
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
!
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
isValidOutputLine:line
d2f19ff163dc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
  1410
    ^ true
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
d2f19ff163dc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
  1413
!Archiver::XarArchive methodsFor:'command strings'!
d2f19ff163dc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
  1414
d2f19ff163dc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
  1415
getCommandToExtractFiles:sel intoDirectory:dir 
d2f19ff163dc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
  1416
    |stream|
d2f19ff163dc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
  1417
d2f19ff163dc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
  1418
    stream := WriteStream on:''.
d2f19ff163dc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
  1419
d2f19ff163dc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
  1420
    "/ '-x'  TarArchivUnpackOption
d2f19ff163dc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
  1421
    "/ '-f'  TarArchivFileOption
d2f19ff163dc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
  1422
    "/ '-C'  TarArchivUnpackInDirectoryOption
d2f19ff163dc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
  1423
    stream nextPutAll:('%1 -x  -C %3 -f "%2"' 
d2f19ff163dc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
  1424
                    bindWith:self class xarCommand
d2f19ff163dc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
  1425
                    with:self fileName asString string
d2f19ff163dc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
  1426
                    with:dir asString).
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
    sel notNil ifTrue:[
d2f19ff163dc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
  1429
        sel do:[:el | 
d2f19ff163dc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
  1430
            stream nextPutAll:' "'.
d2f19ff163dc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
  1431
            stream nextPutAll:(el asString).
d2f19ff163dc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
  1432
            stream nextPutAll:'"'
d2f19ff163dc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
  1433
        ].
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
    ^ stream contents.
d2f19ff163dc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
  1436
!
d2f19ff163dc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
  1437
d2f19ff163dc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
  1438
getCommandToListFiles:aColOfFiles 
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
    "/ '-t'  TarArchivListContentsOption
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
    stream nextPutAll:('%1 -t -f "%2"' 
d2f19ff163dc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
  1446
                    bindWith:self class xarCommand
d2f19ff163dc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
  1447
                    with:self fileName baseName).
d2f19ff163dc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
  1448
d2f19ff163dc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
  1449
    stream nextPutAll:(self class stringWithQuotedFileBaseNames:aColOfFiles).
d2f19ff163dc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
  1450
    ^ stream contents.
d2f19ff163dc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
  1451
! !
d2f19ff163dc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3794
diff changeset
  1452
1086
2af5aca23dba zip added
penk
parents: 1085
diff changeset
  1453
!Archiver::ZipArchive class methodsFor:'command strings'!
2af5aca23dba zip added
penk
parents: 1085
diff changeset
  1454
1215
c3fe5597c1ec refactored
Claus Gittinger <cg@exept.de>
parents: 1205
diff changeset
  1455
unzipCommand
2646
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1456
    |cmdString s cmd|
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1457
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1458
    OperatingSystem isUNIXlike ifTrue:[
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1459
        ^ 'unzip'
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1460
    ].
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1461
    OperatingSystem isMSWINDOWSlike ifTrue:[
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1462
        cmdString := MIMETypes defaultCommandTemplateToOpenMimeType:'application/x-zip-compressed'.
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1463
        cmdString notEmptyOrNil ifTrue:[
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1464
            s := cmdString readStream.
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1465
            s skipSeparators.
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1466
            s peek == $" ifTrue:[
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1467
                s next.
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1468
                cmd := (s upTo:$")
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1469
            ] ifFalse:[
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1470
                cmd := s upToSeparator.
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1471
            ].
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1472
            ^ cmd
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1473
        ].
3787
93aaeeb4a239 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 3651
diff changeset
  1474
        ^ 'winrar.exe'
2646
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1475
    ].
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1476
    ^ nil
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1477
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1478
    "
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1479
     self unzipCommand    
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
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1482
    "Modified: / 16-09-2011 / 17:26:18 / cg"
1086
2af5aca23dba zip added
penk
parents: 1085
diff changeset
  1483
!
2af5aca23dba zip added
penk
parents: 1085
diff changeset
  1484
1215
c3fe5597c1ec refactored
Claus Gittinger <cg@exept.de>
parents: 1205
diff changeset
  1485
zipCommand
2646
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1486
    OperatingSystem isUNIXlike ifTrue:[
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1487
        ^ 'zip'
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1488
    ].
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1489
    OperatingSystem isMSWINDOWSlike ifTrue:[
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1490
        ^ self unzipCommand.
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1491
    ].
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1492
    ^ nil
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1493
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1494
    "Modified: / 16-09-2011 / 16:26:00 / cg"
1086
2af5aca23dba zip added
penk
parents: 1085
diff changeset
  1495
! !
2af5aca23dba zip added
penk
parents: 1085
diff changeset
  1496
2af5aca23dba zip added
penk
parents: 1085
diff changeset
  1497
!Archiver::ZipArchive class methodsFor:'queries'!
2af5aca23dba zip added
penk
parents: 1085
diff changeset
  1498
2af5aca23dba zip added
penk
parents: 1085
diff changeset
  1499
canAddFiles
2af5aca23dba zip added
penk
parents: 1085
diff changeset
  1500
2af5aca23dba zip added
penk
parents: 1085
diff changeset
  1501
    ^ true
2af5aca23dba zip added
penk
parents: 1085
diff changeset
  1502
!
2af5aca23dba zip added
penk
parents: 1085
diff changeset
  1503
2af5aca23dba zip added
penk
parents: 1085
diff changeset
  1504
canRemoveFiles
2af5aca23dba zip added
penk
parents: 1085
diff changeset
  1505
2af5aca23dba zip added
penk
parents: 1085
diff changeset
  1506
    ^ true
1088
f859684fd729 next stage
penk
parents: 1087
diff changeset
  1507
!
f859684fd729 next stage
penk
parents: 1087
diff changeset
  1508
1138
5232eb3c94e0 canView is true for ZipArchives
Claus Gittinger <cg@exept.de>
parents: 1131
diff changeset
  1509
canViewFile
5232eb3c94e0 canView is true for ZipArchives
Claus Gittinger <cg@exept.de>
parents: 1131
diff changeset
  1510
5232eb3c94e0 canView is true for ZipArchives
Claus Gittinger <cg@exept.de>
parents: 1131
diff changeset
  1511
    ^ true
5232eb3c94e0 canView is true for ZipArchives
Claus Gittinger <cg@exept.de>
parents: 1131
diff changeset
  1512
!
5232eb3c94e0 canView is true for ZipArchives
Claus Gittinger <cg@exept.de>
parents: 1131
diff changeset
  1513
1088
f859684fd729 next stage
penk
parents: 1087
diff changeset
  1514
hasLastLine
f859684fd729 next stage
penk
parents: 1087
diff changeset
  1515
    ^ true
f859684fd729 next stage
penk
parents: 1087
diff changeset
  1516
!
f859684fd729 next stage
penk
parents: 1087
diff changeset
  1517
f859684fd729 next stage
penk
parents: 1087
diff changeset
  1518
hasTitleLine
f859684fd729 next stage
penk
parents: 1087
diff changeset
  1519
    ^ true
1086
2af5aca23dba zip added
penk
parents: 1085
diff changeset
  1520
! !
2af5aca23dba zip added
penk
parents: 1085
diff changeset
  1521
1246
1eefc3a60863 output parsing refactored;
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
  1522
!Archiver::ZipArchive methodsFor:'columns'!
1eefc3a60863 output parsing refactored;
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
  1523
1eefc3a60863 output parsing refactored;
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
  1524
columns
1eefc3a60863 output parsing refactored;
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
  1525
1247
4c628a0455c1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1246
diff changeset
  1526
    "/  colums id/readSelector    words to read
1591
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
  1527
    ^ #( (#permissions     1)      
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
  1528
         (#version         2)    
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
  1529
         (#size            1)     
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
  1530
         (#type            1)    
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
  1531
         (#ratio           1)    
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
  1532
         (nil              1)  
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
  1533
         (#dateAndTime     2)  
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
  1534
         (#fileName        #rest)
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
  1535
    ) 
1246
1eefc3a60863 output parsing refactored;
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
  1536
!
1eefc3a60863 output parsing refactored;
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
  1537
1eefc3a60863 output parsing refactored;
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
  1538
isValidOutputLine:line
4219
7ecd6ba2b202 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 4103
diff changeset
  1539
    ('[-d][-r][-w][-x]' match:(line copyToMax:4)) ifTrue:[^ true].
1246
1eefc3a60863 output parsing refactored;
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
  1540
    ^ false.
1eefc3a60863 output parsing refactored;
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
  1541
! !
1eefc3a60863 output parsing refactored;
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
  1542
1086
2af5aca23dba zip added
penk
parents: 1085
diff changeset
  1543
!Archiver::ZipArchive methodsFor:'command strings'!
2af5aca23dba zip added
penk
parents: 1085
diff changeset
  1544
1215
c3fe5597c1ec refactored
Claus Gittinger <cg@exept.de>
parents: 1205
diff changeset
  1545
getCommandToAdd:aColOfFiles toArchive:archiveFile
2646
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1546
    "archiveFile exists ifFalse:[^ nil]."
1088
f859684fd729 next stage
penk
parents: 1087
diff changeset
  1547
2646
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1548
    OperatingSystem isUNIXlike ifTrue:[
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1549
        ^ String streamContents:[:s |
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1550
                s nextPutAll:('%1 -r "%2"' 
1591
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
  1551
                    bindWith:self class zipCommand
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
  1552
                    with:archiveFile asString string).
1088
f859684fd729 next stage
penk
parents: 1087
diff changeset
  1553
2646
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1554
                self 
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1555
                    addDoubleQuotedFilenames:(aColOfFiles collect:[:each | each asFilename baseName])
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1556
                    toStream:s.
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1557
        ].
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1558
    ].
1215
c3fe5597c1ec refactored
Claus Gittinger <cg@exept.de>
parents: 1205
diff changeset
  1559
2646
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1560
    ^ nil
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1561
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1562
    "Modified (comment): / 16-09-2011 / 16:27:20 / cg"
1086
2af5aca23dba zip added
penk
parents: 1085
diff changeset
  1563
!
2af5aca23dba zip added
penk
parents: 1085
diff changeset
  1564
1246
1eefc3a60863 output parsing refactored;
Claus Gittinger <cg@exept.de>
parents: 1215
diff changeset
  1565
getCommandToExtractFiles:aColOfFiles intoDirectory:dir
2646
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1566
    |cmd template|
1087
d6bfc66a3860 next stage
penk
parents: 1086
diff changeset
  1567
2646
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1568
    cmd := self class unzipCommand.
1145
9a6688b7139a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
  1569
2646
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1570
    OperatingSystem isUNIXlike ifTrue:[
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1571
        template := '%1 -o -d "%2" "%3"'
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1572
    ].
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1573
    OperatingSystem isMSDOSlike ifTrue:[
3007
778a3c6b9877 class: Archiver
Claus Gittinger <cg@exept.de>
parents: 2907
diff changeset
  1574
        self halt:'unhandled os'.
2646
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1575
    ].
1087
d6bfc66a3860 next stage
penk
parents: 1086
diff changeset
  1576
2646
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1577
    template notNil ifTrue:[
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1578
        ^ String streamContents:[:s |
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1579
            "/ -o   UnzipOverwriteExistingFilesOption
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1580
            "/ -d   UnzipExtDirectoryOption
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1581
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1582
            s nextPutAll:(template 
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1583
                    bindWith:cmd
1591
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
  1584
                    with:dir asString string
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
  1585
                    with:self fileName asString).
1086
2af5aca23dba zip added
penk
parents: 1085
diff changeset
  1586
2646
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1587
            self addDoubleQuotedFilenames:aColOfFiles toStream:s.
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1588
        ]
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1589
    ].
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1590
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1591
    ^ nil.
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1592
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1593
    "Modified: / 16-09-2011 / 16:38:57 / cg"
1086
2af5aca23dba zip added
penk
parents: 1085
diff changeset
  1594
!
2af5aca23dba zip added
penk
parents: 1085
diff changeset
  1595
1591
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
  1596
getCommandToListFiles:aColOfFiles 
2690
Claus Gittinger <cg@exept.de>
parents: 2689
diff changeset
  1597
    |cmd headlessCmd template|
1086
2af5aca23dba zip added
penk
parents: 1085
diff changeset
  1598
2646
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1599
    cmd := self class unzipCommand.
1144
75008d5f9632 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1139
diff changeset
  1600
2646
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1601
    OperatingSystem isUNIXlike ifTrue:[
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1602
        "/  -Z      ZipInfoOption
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1603
        "/  -h      ZipHeaderOption
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1604
        "/  -t      ZipTotalOption
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1605
        template := '"%1" -Z -m -h "%2"'
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1606
    ].
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1607
    OperatingSystem isMSDOSlike ifTrue:[
4219
7ecd6ba2b202 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 4103
diff changeset
  1608
        |mapping cmdBasename|
7ecd6ba2b202 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 4103
diff changeset
  1609
7ecd6ba2b202 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 4103
diff changeset
  1610
        mapping := #('winrar.exe' 'rar.exe'     '"%1" l "%2"'
7ecd6ba2b202 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 4103
diff changeset
  1611
"/ does not work yet:
7ecd6ba2b202 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 4103
diff changeset
  1612
"/                     '7zFM.exe'   '7z.exe'      '"%1" l "%2"'
7ecd6ba2b202 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 4103
diff changeset
  1613
                    ).
7ecd6ba2b202 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 4103
diff changeset
  1614
        cmdBasename := cmd asFilename baseName.
7ecd6ba2b202 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 4103
diff changeset
  1615
        mapping inGroupsOf:3 do:[:originalBasename :mappedBasename :templ|
7ecd6ba2b202 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 4103
diff changeset
  1616
            (cmdBasename sameAs:originalBasename) ifTrue:[
7ecd6ba2b202 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 4103
diff changeset
  1617
                headlessCmd := cmd asFilename directory construct:mappedBasename.
7ecd6ba2b202 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 4103
diff changeset
  1618
                headlessCmd isExecutableProgram ifTrue:[
7ecd6ba2b202 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 4103
diff changeset
  1619
                    cmd := headlessCmd pathName.
7ecd6ba2b202 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 4103
diff changeset
  1620
                    template := templ.
7ecd6ba2b202 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 4103
diff changeset
  1621
                ].
2690
Claus Gittinger <cg@exept.de>
parents: 2689
diff changeset
  1622
            ].
4219
7ecd6ba2b202 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 4103
diff changeset
  1623
        ].
7ecd6ba2b202 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 4103
diff changeset
  1624
        template isNil ifTrue:[
7ecd6ba2b202 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 4103
diff changeset
  1625
            self halt:'unknown command'
7ecd6ba2b202 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 4103
diff changeset
  1626
        ].
2646
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1627
    ].
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1628
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1629
    template notNil ifTrue:[
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1630
        ^ String streamContents:[:s |
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1631
            s nextPutAll:(template 
4219
7ecd6ba2b202 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 4103
diff changeset
  1632
                            bindWith:cmd with:self fileName asString string).
1139
aea281a4e983 zip file list
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
  1633
2646
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1634
            aColOfFiles notNil ifTrue:[       
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1635
                self breakPoint:#ca.
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1636
                self 
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1637
                    addDoubleQuotedFilenames:(aColOfFiles collect:[:each | each asFilename baseName])
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1638
                    toStream:s.
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1639
            ].
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1640
        ].
1086
2af5aca23dba zip added
penk
parents: 1085
diff changeset
  1641
    ].
2646
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1642
    ^ nil.
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1643
2690
Claus Gittinger <cg@exept.de>
parents: 2689
diff changeset
  1644
    "Modified: / 29-11-2011 / 20:19:18 / cg"
1086
2af5aca23dba zip added
penk
parents: 1085
diff changeset
  1645
!
2af5aca23dba zip added
penk
parents: 1085
diff changeset
  1646
1591
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
  1647
getCommandToRemoveFiles:aColOfFiles 
2646
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1648
    OperatingSystem isUNIXlike ifTrue:[
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1649
        ^ String streamContents:[:s |
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1650
            s nextPutAll:('%1 -d "%2"' 
1591
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
  1651
                        bindWith:self class zipCommand
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
  1652
                        with:self fileName asString string).
1088
f859684fd729 next stage
penk
parents: 1087
diff changeset
  1653
2646
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1654
            self addDoubleQuotedFilenames:aColOfFiles toStream:s.
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1655
        ]
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1656
    ].
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1657
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1658
    ^ nil.
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1659
a3031f695be8 added: #documentation
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
  1660
    "Modified: / 16-09-2011 / 16:29:09 / cg"
1086
2af5aca23dba zip added
penk
parents: 1085
diff changeset
  1661
! !
2af5aca23dba zip added
penk
parents: 1085
diff changeset
  1662
1085
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
  1663
!Archiver class methodsFor:'documentation'!
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
  1664
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
  1665
version
3651
abfe8e55ceaf #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 3512
diff changeset
  1666
    ^ '$Header$'
2689
916e23097292 changed: #initialize
Claus Gittinger <cg@exept.de>
parents: 2688
diff changeset
  1667
!
916e23097292 changed: #initialize
Claus Gittinger <cg@exept.de>
parents: 2688
diff changeset
  1668
916e23097292 changed: #initialize
Claus Gittinger <cg@exept.de>
parents: 2688
diff changeset
  1669
version_CVS
3651
abfe8e55ceaf #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 3512
diff changeset
  1670
    ^ '$Header$'
1085
2ff8d73d5dcf initial checkin
penk
parents:
diff changeset
  1671
! !
1591
f655110a107f stc-compile on Unix
Stefan Vogel <sv@exept.de>
parents: 1590
diff changeset
  1672