| 1 | ################################################################################ |
1 | ################################################################################ |
| 2 | # WeBWorK Online Homework Delivery System |
2 | # WeBWorK Online Homework Delivery System |
| 3 | # Copyright © 2000-2003 The WeBWorK Project, http://openwebwork.sf.net/ |
3 | # Copyright © 2000-2003 The WeBWorK Project, http://openwebwork.sf.net/ |
| 4 | # $CVSHeader: webwork-modperl/lib/WeBWorK/ContentGenerator/Instructor/FileManager.pm,v 1.8 2005/01/27 04:26:37 dpvc Exp $ |
4 | # $CVSHeader: webwork-modperl/lib/WeBWorK/ContentGenerator/Instructor/FileManager.pm,v 1.9 2005/07/02 16:52:31 dpvc Exp $ |
| 5 | # |
5 | # |
| 6 | # This program is free software; you can redistribute it and/or modify it under |
6 | # This program is free software; you can redistribute it and/or modify it under |
| 7 | # the terms of either: (a) the GNU General Public License as published by the |
7 | # the terms of either: (a) the GNU General Public License as published by the |
| 8 | # Free Software Foundation; either version 2, or (at your option) any later |
8 | # Free Software Foundation; either version 2, or (at your option) any later |
| 9 | # version, or (b) the "Artistic License" which comes with this package. |
9 | # version, or (b) the "Artistic License" which comes with this package. |
| … | |
… | |
| 648 | } |
648 | } |
| 649 | |
649 | |
| 650 | my $dir = $self->{courseRoot}.'/'.$self->{pwd}; |
650 | my $dir = $self->{courseRoot}.'/'.$self->{pwd}; |
| 651 | my $archive = uniqueName($dir,(scalar(@files) == 1)? |
651 | my $archive = uniqueName($dir,(scalar(@files) == 1)? |
| 652 | $files[0].".tgz": $self->{courseName}.".tgz"); |
652 | $files[0].".tgz": $self->{courseName}.".tgz"); |
| 653 | my $tar = "cd '$dir' && $self->{ce}{externalPrograms}{tar} -czf $archive "; |
653 | my $tar = "cd '$dir' && $self->{ce}{externalPrograms}{tar} -cvzf $archive "; |
|
|
654 | $tar .= join(" ",@files); |
| 654 | my $files = `$tar`; chomp($files); |
655 | my $files = `$tar`; chomp($files); |
| 655 | if ($? == 0) { |
656 | if ($? == 0) { |
| 656 | my @files = split(/\n/,$files); |
657 | my @files = split(/\n/,$files); |
| 657 | my $n = scalar(@files); my $s = ($n == 1? "": "s"); |
658 | my $n = scalar(@files); my $s = ($n == 1? "": "s"); |
| 658 | $self->addgoodmessage("Archive '$archive' created successfully ($n file$s)"); |
659 | $self->addgoodmessage("Archive '$archive' created successfully ($n file$s)"); |