tests pass

master
Guillermo Dev 7 years ago
parent 10715899a0
commit 79a60f13b2

@ -13,30 +13,29 @@ class FileSystem
return true;
}
$notExistsPart = false;
$parts = explode('/', $path);
if ($file) {
$fileName = array_pop($parts);
}
$partsCount = count($parts);
$buildPath = '';
for ($i=0; $i<$partsCount; $i++) {
$part = $parts[$i];
if (!file_exists($buildPath . "/$part")) {
if (!is_writable($builPath)) {
if (!is_writable($buildPath)) {
if ($throw) {
throw new Exception("Attempting to create : $path, but $buildPath is not writeable.");
}
return false;
}
$notExistsPart = true;
break;
}
$buildPath .= "/$part";
}
if ($file) {
$fileName = array_pop($parts);
}
$dirPath = implode('/', $parts);
mkdir($dirPath, 0777, true);
if (!file_exists($dirPath)) {
mkdir($dirPath, 0777, true);
}
if ($file) {
touch("$dirPath/$fileName");
}

Loading…
Cancel
Save