diff options
author | Sebastian Schmelzer | 2011-05-12 19:28:17 +0200 |
---|---|---|
committer | Sebastian Schmelzer | 2011-05-12 19:28:17 +0200 |
commit | 7aa9620520363551ef4c9adc7f2318661a96265a (patch) | |
tree | 52a6f9616b8831f5df5237df68c25c8b144b3105 /src/lib/OpenSLX | |
parent | Small changes for new Ubuntu 11.04 ... (diff) | |
download | core-7aa9620520363551ef4c9adc7f2318661a96265a.tar.gz core-7aa9620520363551ef4c9adc7f2318661a96265a.tar.xz core-7aa9620520363551ef4c9adc7f2318661a96265a.zip |
update vmchooser
Diffstat (limited to 'src/lib/OpenSLX')
-rw-r--r-- | src/lib/OpenSLX/Utils.pm | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/lib/OpenSLX/Utils.pm b/src/lib/OpenSLX/Utils.pm index 6e722c00..c6d94842 100644 --- a/src/lib/OpenSLX/Utils.pm +++ b/src/lib/OpenSLX/Utils.pm @@ -24,6 +24,7 @@ $VERSION = 1.01; @EXPORT = qw( copyFile fakeFile linkFile + copyDir copyBinaryWithRequiredLibs slurpFile spitFile appendFile followLink @@ -95,6 +96,28 @@ sub copyFile return; } + +sub copyDir +{ + my $dirName = shift || croak 'need to pass in a fileName!'; + my $targetBase = shift || croak 'need to pass in target dir!'; + my $targetDirName = shift || ''; + + mkpath($targetBase) unless -d $targetBase; + my $target = "$targetBase/$targetDirName"; + vlog(2, _tr("copying '%s' to '%s'", $dirName, $target)); + if (system("cp -pr $dirName $target")) { + croak( + _tr( + "unable to copy file '%s' to dir '%s' (%s)", + $dirName, $target, $! + ) + ); + } + return; +} + + =item B<fakeFile($fullPath)> Creates the (empty) file I<$fullPath> unless it already exists. |