示例#1
0
文件: Directory.php 项目: jgswift/qio
 /**
  * Default constructor for directory base
  * @param string $path
  */
 function __construct($path)
 {
     if (!Str::endsWith($path, '/')) {
         $path .= '/';
     }
     if (!Str::startsWith($path, '/')) {
         $path = '/' . $path;
     }
     $cwd = getcwd();
     if (strpos($path, $cwd) === false) {
         $path = $cwd . $path;
     }
     $path = Str::flipDS($path);
     $this->path = $path;
 }
示例#2
0
文件: Cache.php 项目: jgswift/qio
 /**
  * Retrieves cache destination of specific source asset
  * @param \qio\Asset $asset
  * @return \qio\File\Asset
  */
 public function getTarget(qio\Asset $asset)
 {
     $path = qtil\StringUtil::flipDS($asset->getPath());
     $nfo = pathinfo($path);
     $basename = $nfo['basename'];
     $targetPath = $this->getDestination()->getPath() . DIRECTORY_SEPARATOR . $basename;
     return new \qio\File\Asset($this, $targetPath);
 }