$nonExisting = new NonExistingFolder($this->root, $this->view, $fullPath);
$this->sendHooks(['preWrite', 'preCreate'], [$nonExisting]);
if (!$this->view->mkdir($fullPath)) {
- throw new NotPermittedException('Could not create folder');
+ throw new NotPermittedException('Could not create folder "' . $fullPath . '"');
}
- $node = new Folder($this->root, $this->view, $fullPath);
+ $parent = dirname($fullPath) === $this->getPath() ? $this : null;
+ $node = new Folder($this->root, $this->view, $fullPath, null, $parent);
$this->sendHooks(['postWrite', 'postCreate'], [$node]);
return $node;
} else {
$result = $this->view->touch($fullPath);
}
if ($result === false) {
- throw new NotPermittedException('Could not create path');
+ throw new NotPermittedException('Could not create path "' . $fullPath . '"');
}
- $node = new File($this->root, $this->view, $fullPath);
+ $node = new File($this->root, $this->view, $fullPath, null, $this);
$this->sendHooks(['postWrite', 'postCreate'], [$node]);
return $node;
}
$this->view->rmdir($this->path);
$nonExisting = new NonExistingFolder($this->root, $this->view, $this->path, $fileInfo);
$this->sendHooks(['postDelete'], [$nonExisting]);
- $this->exists = false;
} else {
- throw new NotPermittedException('No delete permission for path');
+ throw new NotPermittedException('No delete permission for path "' . $this->path . '"');
}
}