예제 #1
0
 /**
  * Prefix a path with the root
  *
  * @param   string  $path
  * @return  string  prefixed path
  */
 public function prefix($path)
 {
     if ($path === '') {
         return $this->root;
     }
     $path = str_replace('/', DIRECTORY_SEPARATOR, $path);
     return $this->root . Util::normalizePath($path, DIRECTORY_SEPARATOR);
 }
예제 #2
0
 /**
  * Get a file/directory handler
  *
  * @param   string   $path
  * @param   Handler  $handler
  * @return  Handler  file or directory handler
  */
 public function get($path, Handler $handler = null)
 {
     $path = Util::normalizePath($path);
     if (!$handler) {
         $metadata = $this->getMetadata($path);
         $handler = $metadata['type'] === 'file' ? new File($this, $path) : new Directory($this, $path);
     }
     $handler->setPath($path);
     $handler->setFilesystem($this);
     return $handler;
 }