424 ]. |
424 ]. |
425 |
425 |
426 ] priority:(Processor systemBackgroundPriority). |
426 ] priority:(Processor systemBackgroundPriority). |
427 process name:('Archiver command: ', cmd). |
427 process name:('Archiver command: ', cmd). |
428 process resume. |
428 process resume. |
|
429 ^true |
429 ] |
430 ] |
430 ! |
431 ! |
431 |
432 |
432 isValidOutputLine:line |
433 isValidOutputLine:line |
433 "return true, if line contains a valid list-files output line" |
434 "return true, if line contains a valid list-files output line" |
477 ! ! |
478 ! ! |
478 |
479 |
479 !Archiver::MultiFileArchive methodsFor:'actions'! |
480 !Archiver::MultiFileArchive methodsFor:'actions'! |
480 |
481 |
481 addFilesToArchive:colOfFiles |
482 addFilesToArchive:colOfFiles |
482 |cmd tempDir archivFile archivInTemp fileSize backupFile| |
483 |cmd tempDir archivFile archivInTemp fileSize backupFile result| |
483 |
484 |
484 archivFile := self fileName. |
485 archivFile := self fileName. |
485 |
486 |
486 tempDir := self temporaryDirectory. |
487 tempDir := self temporaryDirectory. |
487 archivInTemp := tempDir construct:(archivFile baseName). |
488 archivInTemp := tempDir construct:(archivFile baseName). |
507 file isDirectory |
508 file isDirectory |
508 ifTrue: [destName := tempDir]. |
509 ifTrue: [destName := tempDir]. |
509 file recursiveCopyTo:destName. |
510 file recursiveCopyTo:destName. |
510 ]. |
511 ]. |
511 |
512 |
512 "/ addFiles to the tar archive |
513 "/ addFiles to the archive. Synchron command execution answers |
|
514 "/ a boolean. |
513 cmd := self getCommandToAdd:colOfFiles toArchive:archivInTemp. |
515 cmd := self getCommandToAdd:colOfFiles toArchive:archivInTemp. |
514 self executeCommand:cmd directory:tempDir. |
516 result := self executeCommand:cmd directory:tempDir. |
515 |
517 |
516 "/ copy tar archiv back |
518 "/ copy the archive back |
517 archivInTemp copyTo:archivFile. |
519 (result == true and: [archivInTemp exists]) ifTrue:[ |
|
520 archivInTemp copyTo:archivFile. |
|
521 ]. |
518 ] ensure:[ |
522 ] ensure:[ |
519 "/ cg: remove the tempFile |
523 "/ cg: remove the tempFile |
520 archivInTemp remove. |
524 archivInTemp exists ifTrue:[ archivInTemp remove.]. |
521 "/ cg: remove copied files |
525 "/ cg: remove copied files |
522 " colOfFiles do:[:file | |
526 " colOfFiles do:[:file | |
523 (tempDir construct:(file asFilename baseName)) remove. |
527 (tempDir construct:(file asFilename baseName)) remove. |
524 ]. " |
528 ]. " |
525 "/ boris: remove the temporary directory and its name, too. |
529 "/ boris: remove the temporary directory and its name, too. |
526 tempDir recursiveRemove. |
530 tempDir recursiveRemove. |
527 temporaryDirectory := nil. |
531 temporaryDirectory := nil. |
528 |
532 ]. |
529 ]. |
533 |
|
534 ^result == true. |
530 ! |
535 ! |
531 |
536 |
532 extractFiles:aColOfFilesOrNil to:aDirectory |
537 extractFiles:aColOfFilesOrNil to:aDirectory |
533 |execDir cmd| |
538 |execDir cmd| |
534 |
539 |