# HG changeset patch # User Claus Gittinger # Date 1053109787 -7200 # Node ID 2fa2537a4a74f0d935685c989bca80ab4d87e2a3 # Parent bf2dd6a13fa52fb3a4b4ee575f899ed6dbc466d0 *** empty log message *** diff -r bf2dd6a13fa5 -r 2fa2537a4a74 FileApplicationNoteBook.st --- a/FileApplicationNoteBook.st Fri May 16 17:59:46 2003 +0200 +++ b/FileApplicationNoteBook.st Fri May 16 20:29:47 2003 +0200 @@ -958,22 +958,6 @@ ]. ]. ^ class. -! - -supportedFiles - - | dict | - dict := Dictionary new. - - #( - 'application/x-tar-compressed' tarGZipArchive - 'application/x-tar' tarArchive - 'application/x-gzip-compressed' gzipArchive - 'application/x-zip-compressed' zipArchive - ) pairWiseDo:[ : mimeType :classSelector | - dict at:mimeType put:classSelector. - ]. - ^ dict ! ! !FileApplicationNoteBook::ArchiveViewApplication class methodsFor:'defaults'! @@ -1352,7 +1336,7 @@ !FileApplicationNoteBook::ArchiveViewApplication class methodsFor:'queries'! canOpenItem:aItem - ^ (aItem hasMimeType and:[(aItem mimeType isArchive) and:[OperatingSystem isUNIXlike]]) + ^ (Archiver classForMimeType:aItem mimeType) notNil and:[OperatingSystem isUNIXlike] ! wantNewApplicationAnyway @@ -1578,15 +1562,15 @@ ! item:aItem - | classSelector| - super item:aItem. + self removeErrorOutput. - classSelector := self class classSelectorFor:aItem. - (classSelector notNil and:[(Archiver respondsTo:classSelector) notNil]) ifTrue:[ + archiver := Archiver newFor:self fileName. + + archiver notNil ifTrue:[ self makeProcessFor:[ - self archiver:((Archiver perform:classSelector) with:(self fileName)). + self archiver:archiver. self setColumnsForArchiver. ] with:'Setup archive'. @@ -1610,7 +1594,7 @@ changeItem:aItem self item:aItem. self clearFileList. - self listAllFilesFromArchive. + self listAllFiles. ^ true ! @@ -1843,7 +1827,7 @@ firstLineNotReaded := true. ^ [: line | - | words ownerGroup item archiverColumns itemWriter index itemWordCount| + | words ownerGroup item archiverColumns index itemWordCount| (firstLineNotReaded and:[archiver class hasTitleLine]) ifTrue:[ firstLineNotReaded := false. @@ -1853,9 +1837,13 @@ item := ArchivItem new. index := 1. archiverColumns do:[:colDescr | - | itemStream | + | itemStream itemFieldSelector itemWriter | + itemWordCount := colDescr second. - itemWriter := ((colDescr first) asString, ':') asSymbol. + itemFieldSelector := colDescr first. + itemFieldSelector notNil ifTrue:[ + itemWriter := (itemFieldSelector , ':') asSymbol. + ]. itemStream := WriteStream on:''. itemWordCount == #rest ifTrue:[ index to:(words size) do:[:i| @@ -1869,7 +1857,9 @@ ]. index := index + itemWordCount. ]. - item perform:itemWriter with:(itemStream contents). + itemWriter notNil ifTrue:[ + item perform:itemWriter with:(itemStream contents). + ]. itemStream close. ]. ((archiverColumns collect:[:el| el first]) includes:#permissions) ifTrue:[ @@ -2035,9 +2025,9 @@ "/ ugly code alarm. (self archiver class == Archiver zipArchive) ifTrue:[ - self listAllFilesFromArchive + self listAllFiles ] ifFalse:[ - self listFilesFromArchive:colOfFiles + self listFiles:colOfFiles ]. ^ true ! ! @@ -2087,7 +2077,7 @@ errorStream:(self getErrorStream) synchron:true. self - makeProcessFor:[ self archiver extractTo:aDirectory ] + makeProcessFor:[ self archiver extractFilesTo:aDirectory ] with:'Extracting all files'. ^ true. ! @@ -2133,7 +2123,7 @@ errorStream:(self getErrorStream) synchron:true. self - makeProcessFor:[ self archiver extractTo:aDirectory with:extractFiles ] + makeProcessFor:[ self archiver extractFiles:extractFiles to:aDirectory ] with:('Extracting files to %1' bindWith:aDirectory asString). ^ true. ! @@ -2147,8 +2137,8 @@ self makeProcessFor:[ self archiver - extractWithOutDirectoryTo:aDirectory - with:(extractFiles collect:[:item| item fileName]). + extractFiles:(extractFiles collect:[:item| item fileName]) + withoutDirectoryTo:aDirectory. ] with:('Extracting files to %1' bindWith:aDirectory asString). ^ true. @@ -2156,24 +2146,26 @@ !FileApplicationNoteBook::ArchiveViewApplication methodsFor:'commands list'! -listAllFilesFromArchive +listAllFiles self archiveFileList value removeAll. - self listFilesFromArchive:nil -! - -listFilesFromArchive:newColOfFiles + self listFiles:nil +! + +listFiles:aColOfFilesOrNil process notNil ifTrue:[ process waitUntilTerminated ]. - self archiver - outStream:(self getOutStream) - errorStream:(self getErrorStream) - synchron:true. - - self - makeProcessFor:[self archiver listFilesFromArchive:newColOfFiles] - with:'List files' + archiver notNil ifTrue:[ + self archiver + outStream:(self getOutStream) + errorStream:(self getErrorStream) + synchron:true. + + self + makeProcessFor:[self archiver listFiles:aColOfFilesOrNil] + with:'List files' + ] ! ! !FileApplicationNoteBook::ArchiveViewApplication methodsFor:'commands remove'! @@ -2353,7 +2345,7 @@ ^ self ] ]. - self listAllFilesFromArchive. + self listAllFiles. ^ super postOpenWith:aBuilder ! @@ -4951,5 +4943,5 @@ !FileApplicationNoteBook class methodsFor:'documentation'! version - ^ '$Header: /cvs/stx/stx/libtool/FileApplicationNoteBook.st,v 1.79 2003-05-14 11:04:55 stefan Exp $' + ^ '$Header: /cvs/stx/stx/libtool/FileApplicationNoteBook.st,v 1.80 2003-05-16 18:29:47 cg Exp $' ! !