diff options
author | Oliver Tappe | 2008-01-16 16:02:25 +0100 |
---|---|---|
committer | Oliver Tappe | 2008-01-16 16:02:25 +0100 |
commit | 8126b0e64997308e2c67ce6e1677ce77581527f2 (patch) | |
tree | 96d41b0ff9bfe8ea8e9265fce2a7c4a62763c1d1 /lib/OpenSLX/Utils.pm | |
parent | * started to work on re-implementation of mkdxsinitrd in perl (diff) | |
download | core-8126b0e64997308e2c67ce6e1677ce77581527f2.tar.gz core-8126b0e64997308e2c67ce6e1677ce77581527f2.tar.xz core-8126b0e64997308e2c67ce6e1677ce77581527f2.zip |
* use mkpath() instead of system()
git-svn-id: http://svn.openslx.org/svn/openslx/trunk@1478 95ad53e4-c205-0410-b2fa-d234c58c8868
Diffstat (limited to 'lib/OpenSLX/Utils.pm')
-rw-r--r-- | lib/OpenSLX/Utils.pm | 7 |
1 files changed, 4 insertions, 3 deletions
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( |