From 7aa9620520363551ef4c9adc7f2318661a96265a Mon Sep 17 00:00:00 2001 From: Sebastian Schmelzer Date: Thu, 12 May 2011 19:28:17 +0200 Subject: update vmchooser --- src/lib/OpenSLX/Utils.pm | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'src/lib/OpenSLX') 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 Creates the (empty) file I<$fullPath> unless it already exists. -- cgit v1.2.3-55-g7522