tests pass
This commit is contained in:
@@ -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);
|
||||
if (!file_exists($dirPath)) {
|
||||
mkdir($dirPath, 0777, true);
|
||||
}
|
||||
if ($file) {
|
||||
touch("$dirPath/$fileName");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user