From 589421187172f15a8a54680d830bbcde4637ad1d Mon Sep 17 00:00:00 2001 From: Vincent Vanwaelscappel Date: Fri, 1 Sep 2023 19:26:54 +0200 Subject: [PATCH] wip #6237 @1 --- src/Files/Files.php | 4 +++- src/Files/VirtualDirectory.php | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/Files/Files.php b/src/Files/Files.php index b7bdc30..21f0136 100644 --- a/src/Files/Files.php +++ b/src/Files/Files.php @@ -40,7 +40,9 @@ class Files throw new \RuntimeException(sprintf('Directory "%s" was not created', $path)); } } catch (\Exception $e) { - throw new \RuntimeException(sprintf('Directory "%s" was not created. %s', $path, $e->getMessage())); + if(!file_exists($path)) { + throw new \RuntimeException(sprintf('Directory "%s" was not created. %s', $path, $e->getMessage())); + } } } return realpath($path) . '/'; diff --git a/src/Files/VirtualDirectory.php b/src/Files/VirtualDirectory.php index 772eac3..c1e8db2 100644 --- a/src/Files/VirtualDirectory.php +++ b/src/Files/VirtualDirectory.php @@ -23,9 +23,9 @@ class VirtualDirectory $this->_tmp = array(); } - public function copy($from, $to, $prepend = false) + public function copy($from, $to, $prepend = false,$check=true) { - if (!file_exists($from)) { + if ($check && !file_exists($from)) { throw new \Exception(sprintf('File "%s" doesn\'t exist (to %s)', $from, $to)); } $realto = $this->path($to); -- 2.39.5