Пример #1
0
 /**
  *
  * Construct a \Mbcraft\Piol\File instance.
  *
  * @param string $path The path of the file.
  *
  * @api
  */
 public function __construct($path)
 {
     parent::__construct($path);
 }
Пример #2
0
 public static function setDefaultPermissionsRwx($perms)
 {
     self::$defaultPermissionsRwx = $perms;
 }
Пример #3
0
 /**
  * 
  * Creates a new subdirectory inside this one, or returns an existing one, 
  * returning a \Mbcraft\Piol\Dir instance pointing to it.
  * 
  * @param string $name The name of the subdirectory to create.
  * @return \Mbcraft\Piol\Dir The existing subdirectory.
  * @throws \Mbcraft\Piol\IOException If the specified name is already used for another kind of file system element or it's not possible to create the directory.
  * 
  * @api
  */
 public function newSubdir($name)
 {
     FileSystemUtils::checkValidFilename($name);
     if (FileSystemUtils::isDir($this->__path . DS . $name)) {
         //directory already exists
         //echo "Directory already exists : ".$this->__full_path."/".$name;
         return new Dir($this->__path . DS . $name);
     }
     if (FileSystemUtils::isFile($this->__path . DS . $name)) {
         throw new IOException("The specified name is an already existing file");
     }
     //directory or files do not exists
     $result = @mkdir($this->__full_path . $name, __FileSystemElement::getDefaultPermissionsOctal(), true);
     if ($result == true) {
         return new Dir($this->__path . $name);
     } else {
         throw new IOException("Unable to create dir : " . $this->__full_path . $name);
     }
 }
Пример #4
0
 function __construct($path)
 {
     $new_path = str_replace("\\", DS, $path);
     parent::__construct($new_path);
 }