Archiver.st
changeset 4219 7ecd6ba2b202
parent 4103 d2f19ff163dc
child 4244 66c023206027
equal deleted inserted replaced
4217:1dac9014b77a 4219:7ecd6ba2b202
  1402          (#fileName        #rest)
  1402          (#fileName        #rest)
  1403     ) 
  1403     ) 
  1404 !
  1404 !
  1405 
  1405 
  1406 isValidOutputLine:line
  1406 isValidOutputLine:line
  1407     ('[-d][-r][-w][-x]' match:(line copyTo:4)) ifTrue:[^ true].
  1407     ('[-d][-r][-w][-x]' match:(line copyToMax:4)) ifTrue:[^ true].
  1408     ^ false.
  1408     ^ false.
  1409 ! !
  1409 ! !
  1410 
  1410 
  1411 !Archiver::ZipArchive methodsFor:'command strings'!
  1411 !Archiver::ZipArchive methodsFor:'command strings'!
  1412 
  1412 
  1471         "/  -h      ZipHeaderOption
  1471         "/  -h      ZipHeaderOption
  1472         "/  -t      ZipTotalOption
  1472         "/  -t      ZipTotalOption
  1473         template := '"%1" -Z -m -h "%2"'
  1473         template := '"%1" -Z -m -h "%2"'
  1474     ].
  1474     ].
  1475     OperatingSystem isMSDOSlike ifTrue:[
  1475     OperatingSystem isMSDOSlike ifTrue:[
  1476         (cmd asFilename baseName sameAs: 'WinRAR.exe') ifTrue:[
  1476         |mapping cmdBasename|
  1477             headlessCmd := cmd asFilename directory construct:'rar.exe'.
  1477 
  1478             headlessCmd exists ifTrue:[
  1478         mapping := #('winrar.exe' 'rar.exe'     '"%1" l "%2"'
  1479                 cmd := headlessCmd.
  1479 "/ does not work yet:
  1480                 template := '"%1" l "%2"'
  1480 "/                     '7zFM.exe'   '7z.exe'      '"%1" l "%2"'
       
  1481                     ).
       
  1482         cmdBasename := cmd asFilename baseName.
       
  1483         mapping inGroupsOf:3 do:[:originalBasename :mappedBasename :templ|
       
  1484             (cmdBasename sameAs:originalBasename) ifTrue:[
       
  1485                 headlessCmd := cmd asFilename directory construct:mappedBasename.
       
  1486                 headlessCmd isExecutableProgram ifTrue:[
       
  1487                     cmd := headlessCmd pathName.
       
  1488                     template := templ.
       
  1489                 ].
  1481             ].
  1490             ].
  1482         ] ifFalse:[
  1491         ].
  1483             self halt:'unhandled unzip command'.
  1492         template isNil ifTrue:[
  1484         ]
  1493             self halt:'unknown command'
       
  1494         ].
  1485     ].
  1495     ].
  1486 
  1496 
  1487     template notNil ifTrue:[
  1497     template notNil ifTrue:[
  1488         ^ String streamContents:[:s |
  1498         ^ String streamContents:[:s |
  1489             s nextPutAll:(template 
  1499             s nextPutAll:(template 
  1490                         bindWith:cmd
  1500                             bindWith:cmd with:self fileName asString string).
  1491                         with:self fileName asString string).
       
  1492 
  1501 
  1493             aColOfFiles notNil ifTrue:[       
  1502             aColOfFiles notNil ifTrue:[       
  1494                 self breakPoint:#ca.
  1503                 self breakPoint:#ca.
  1495                 self 
  1504                 self 
  1496                     addDoubleQuotedFilenames:(aColOfFiles collect:[:each | each asFilename baseName])
  1505                     addDoubleQuotedFilenames:(aColOfFiles collect:[:each | each asFilename baseName])