From 8126b0e64997308e2c67ce6e1677ce77581527f2 Mon Sep 17 00:00:00 2001 From: Oliver Tappe Date: Wed, 16 Jan 2008 15:02:25 +0000 Subject: * use mkpath() instead of system() git-svn-id: http://svn.openslx.org/svn/openslx/trunk@1478 95ad53e4-c205-0410-b2fa-d234c58c8868 --- lib/OpenSLX/Utils.pm | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'lib') diff --git a/lib/OpenSLX/Utils.pm b/lib/OpenSLX/Utils.pm index 7668cba0..5ced685e 100644 --- a/lib/OpenSLX/Utils.pm +++ b/lib/OpenSLX/Utils.pm @@ -39,6 +39,7 @@ $VERSION = 1.01; ### Module implementation ################################################################################ use File::Basename; +use File::Path; use Socket; use Sys::Hostname; use Term::ReadLine; @@ -51,7 +52,7 @@ sub copyFile my $targetDir = shift || croak 'need to pass in target dir!'; my $targetFileName = shift || ''; - system("mkdir -p $targetDir") unless -d $targetDir; + mkpath($targetDir) unless -d $targetDir; my $target = "$targetDir/$targetFileName"; vlog(2, _tr("copying '%s' to '%s'", $fileName, $target)); if (system("cp -p $fileName $target")) { @@ -70,7 +71,7 @@ sub fakeFile my $fullPath = shift || croak 'need to pass in full path!'; my $targetDir = dirname($fullPath); - system("mkdir", "-p", $targetDir) unless -d $targetDir; + mkpath($targetDir) unless -d $targetDir; if (system("touch", $fullPath)) { croak(_tr("unable to create file '%s' (%s)", $fullPath, $!)); } @@ -83,7 +84,7 @@ sub linkFile my $linkName = shift || croak 'need to pass in link name!'; my $targetDir = dirname($linkName); - system("mkdir -p $targetDir") unless -d $targetDir; + mkpath($targetDir) unless -d $targetDir; if (system("ln -sfn $linkTarget $linkName")) { croak( _tr( -- cgit v1.2.3-55-g7522