allow File::cpdir() to fail (and return false)
This commit is contained in:
parent
d12f868f8c
commit
2c4d35e6a4
|
@ -183,7 +183,7 @@ public static function is($extensions, $path)
|
||||||
*/
|
*/
|
||||||
public static function mvdir($source, $destination, $options = fIterator::SKIP_DOTS)
|
public static function mvdir($source, $destination, $options = fIterator::SKIP_DOTS)
|
||||||
{
|
{
|
||||||
static::cpdir($source, $destination, true, $options);
|
return static::cpdir($source, $destination, true, $options);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -197,7 +197,7 @@ public static function mvdir($source, $destination, $options = fIterator::SKIP_D
|
||||||
*/
|
*/
|
||||||
public static function cpdir($source, $destination, $delete = false, $options = fIterator::SKIP_DOTS)
|
public static function cpdir($source, $destination, $delete = false, $options = fIterator::SKIP_DOTS)
|
||||||
{
|
{
|
||||||
if ( ! is_dir($source)) return;
|
if ( ! is_dir($source)) return false;
|
||||||
|
|
||||||
// First we need to create the destination directory if it doesn't
|
// First we need to create the destination directory if it doesn't
|
||||||
// already exists. This directory hosts all of the assets we copy
|
// already exists. This directory hosts all of the assets we copy
|
||||||
|
@ -221,7 +221,7 @@ public static function cpdir($source, $destination, $delete = false, $options =
|
||||||
{
|
{
|
||||||
$path = $item->getRealPath();
|
$path = $item->getRealPath();
|
||||||
|
|
||||||
static::cpdir($path, $location, $delete, $options);
|
if (! static::cpdir($path, $location, $delete, $options)) return false;
|
||||||
|
|
||||||
if ($delete) @rmdir($item->getRealPath());
|
if ($delete) @rmdir($item->getRealPath());
|
||||||
}
|
}
|
||||||
|
@ -231,13 +231,15 @@ public static function cpdir($source, $destination, $delete = false, $options =
|
||||||
// files with the same name.
|
// files with the same name.
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
copy($item->getRealPath(), $location);
|
if(! copy($item->getRealPath(), $location)) return false;
|
||||||
|
|
||||||
if ($delete) @unlink($item->getRealPath());
|
if ($delete) @unlink($item->getRealPath());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($delete) rmdir($source);
|
if ($delete) rmdir($source);
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue