public function testDeleteDirectory3() { File::makeDirectory(__DIR__ . '/dummy/tmp2'); File::copy(__DIR__ . '/dummy/dummy.jpg', __DIR__ . '/dummy/tmp2/dummy.jpg'); File::makeDirectory(__DIR__ . '/dummy/tmp2/test'); File::copy(__DIR__ . '/dummy/dummy.jpg', __DIR__ . '/dummy/tmp2/test/dummy.jpg'); $path = __DIR__ . '/dummy/tmp2/'; $this->assertTrue(File::deleteDirectory($path)); }
/** * creates folder recursively if there's none * must have a prefix, by default /public. * * @param string $path Path to be created */ public function directorize($path) { $folders = explode('/', $path); $pathbuild = $this->prefix; foreach ($folders as $folder) { $pathbuild .= "{$folder}/"; $cond = File::exists($pathbuild) && File::isDirectory($pathbuild); if (!$cond) { File::makeDirectory($pathbuild); File::put("{$pathbuild}.gitkeep", 'Generated by `anekdotes/manager`'); } } }