function FMDiskFileSystem::createDir in N1ED - Visual editor as CKEditor plugin with Bootstrap support 8.2
Creates a directory.
Overrides FMDiskFileSystemInterface::createDir
File
- src/
Flmngr/ FlmngrServer/ fs/ FMDiskFileSystem.php, line 133
Class
- FMDiskFileSystem
- Implements file system interface. Provides an interface to access file system (local disc FS). This is the correct module to replace if you want to implement some custom file system support (i. e. network file system like Amazon S3).
Namespace
Drupal\n1ed\Flmngr\FlmngrServer\fsCode
function createDir($dirPath, $name) {
if (strpos($name, "..") !== FALSE || strpos($name, "/") !== FALSE) {
throw new MessageException(FMMessage::createMessage(FMMessage::FM_DIR_NAME_CONTAINS_INVALID_SYMBOLS));
}
$fullPath = $this
->getAbsolutePath($dirPath) . "/" . $name;
$res = file_exists($fullPath) || mkdir($fullPath, 0777, true);
if ($res === FALSE) {
throw new MessageException(FMMessage::createMessage(FMMessage::FM_UNABLE_TO_CREATE_DIRECTORY));
}
}