设置程序基本路径
@param string $path
@throws \Exception
486626
public function setBasePath($path)
    {
        if (($this->_basePath = realpath($path)) === false || !is_dir($this->_basePath)) {
            throw new \Exception('程序基本路径' . $this->_basePath . '设置失败');
        }
    }
1131603
public static function setClassIndexMap($path)
    {
        if (is_array($path)) {
            self::$resultClassIndexMap = $path;
        } elseif (file_exists($path) && is_readable($path)) {
            self::$resultClassIndexMap = require_once($path);
        } else {
            throw new RuntimeException("Path $path does not exists or is not readable.");
        }
    }
640505
protected function _getOssClient($path)
    {
        if ($this->_oss === null) {
            $url = explode(':', $path);

            if (empty($url)) {
                throw new Exception("Unable to parse URL $path");
            }

            $this->_oss = AliyunOSS::getWrapperClient($url[0]);

            if (!$this->_oss) {
                throw new Exception("Unknown client for wrapper {$url[0]}");
            }
        }

        return $this->_oss;
    }
486640
public function setException($path) {
        $pathException = (!is_array($path)) ? array($path) : $path;
        $this->exceptions = array_merge($this->exceptions, $pathException);
    }
458206
public function setActive($path) {
		if (!isset($this->_nodes[$path])) {
			throw new \Exception(__METHOD__.': path "'.$path.'" does not exist.');
			return;
		}

		// set active path to retrieve the breadcrumb
		$this->_active_path = $path;

		// set all nodes to inactive
		foreach ($this->_nodes as $key => $item) {
			$this->_nodes[$key]['active'] = false;
		}

		// set actual node to active
		$actual =& $this->_nodes[$path];
		$actual['active'] = true;

		// loop to the top and set to active
		while (isset($this->_nodes[$actual['parent']])) {
			$actual =& $this->_nodes[$actual['parent']];
			$actual['active'] = true;
		}

		// return actual node
		return $this->_nodes[$path];
	}
943411
public function get($path)
    {
        if (! $this->has($path) && ! $this->has('*')) {
            throw new \Exception('There is no collection that collects for the path ['.$path.']');
        }

        if (! $this->has($path) && $this->has('*')) {
            return $this->items[$this->pathLookupTable['*']];
        }

        return $this->items[$this->pathLookupTable[$path]];
    }
1184246
public function setResourcePath($path)
    {
        $escapedPath = rtrim($path, '/');
        if (!file_exists($escapedPath)) {
            throw new Exception(sprintf(
                "The path '%s' to resources' folder does not exist!",
                $escapedPath
            ));
        }

        $this->resourcePath = $escapedPath;
    }
876979
public function getMetadata($path)
    {
        try {
            $file_info = $this->getUpyun()->getFileInfo($path);
            if ( !empty($file_info) ) {
                return $file_info;
            }
        }catch (Exception $exception){
            //调试信息
            //echo $exception->getMessage();
        }
        return false;
    }
726679
public function setPath($path)
	{
		if ( ! $this->files->exists($path) ) {
			$result = $this->files->put($path, '{}');
			if ( $result === false ) {
				throw new NotWritableException("Could not write to $path.");
			}
		}

		if ( ! $this->files->isWritable($path) ) {
			throw new NotWritableException("$path is not writable.");
		}

		$this->path = $path;
	}
778020
private function buildDistDir(string $distPath): void
    {
        $distDir = dirname($distPath);
        if (! is_dir($distDir)) {
            if (@mkdir($distDir, 0755, true) === false) {
                throw new \Exception('创建目录' . $distDir . '失败');
            }
        }
    }
242357
protected function recursiveDeleteDir($path)
    {
        $path       = static::normalizerPath($path);
        $file_list  = $this->listContents($path);

        if ( is_array($file_list) && count($file_list) > 0 ) {
            foreach ($file_list as $file) {
                //如果是文件，则把文件删除
                if ($file['type'] == self::FILE_TYPE_FILE) {
                    $this->delete($path . $this->pathSeparator . $file['name']);
                } else {
                    $this->recursiveDeleteDir($path . $this->pathSeparator . $file['name']);
                }
            }
        }
        $this->getUpyun()->rmDir($path);
    }
1321037
public function size( $path )
	{
		try {
			return $this->fs->size( $path );
		} catch( \Exception $e ) {
			throw new Exception( $e->getMessage(), 0, $e );
		}
	}
892488
public function rssFeedAction($path)
    {
        try {
            $this->setPath($path);
        } catch (NotFoundException $e) {
            throw $e;
        }

        $dbfile     = new WDBFile($this->getpath());
        $contents   = array();
        $tpl_params = array(
            'page'          => $dbfile->getWDBFullStack(),
            'breadcrumbs'   => TemplateHelper::getBreadcrumbs($this->getPath()),
            'title'         => TemplateHelper::buildPageTitle($this->getPath()),
        );
        if (empty($tpl_params['title'])) {
            if (!empty($tpl_params['breadcrumbs'])) {
                $tpl_params['title'] = TemplateHelper::buildPageTitle(end($tpl_params['breadcrumbs']));
            } else {
                $tpl_params['title'] = _T('Home');
            }
        }

        $this->wdb->getResponse()->setContentType('xml');

        $page = $dbfile->getWDBStack();
        if ($dbfile->isDir()) {
            $contents = Helper::getFlatDirscans($dbfile->getWDBScanStack(true), true);
            foreach ($contents['dirscan'] as $i=>$item) {
                if ($item['type']!=='dir' && file_exists($item['path'])) {
                    $dbfile = new WDBFile($item['path']);
                    $contents['dirscan'][$i]['content'] = $dbfile->viewIntroduction(4000, false);
                }
            }
        } else {
            $page['content'] = $dbfile->viewIntroduction(4000, false);
        }
        
        $rss_content = $this->wdb->display('', 'rss', array(
            'page'      => $page,
            'contents'  => $contents
        ));

        return array('layout_empty_xml', $rss_content);
    }
247194
public function writes( $path, $stream )
	{
		if( ( $content = @fread( $stream, 0x7ffffffd ) ) === false ) {
			$error = error_get_last();
			throw new Exception( $error['message'] );
		}

		try {
			$this->fs->put( $path, $content );
		} catch( \Exception $e ) {
			throw new Exception( $e->getMessage(), 0, $e );
		}
	}
375953
private function setPath($path)
    {
        $parts = pathinfo($path);

        $this->info['path'] = [];

        if (isset($parts['dirname'])) {
            foreach (explode('/', str_replace(DIRECTORY_SEPARATOR, '/', $parts['dirname'])) as $dir) {
                if ($dir !== '') {
                    $this->info['path'][] = $dir;
                }
            }
        }

        $this->info['file'] = isset($parts['filename']) ? $parts['filename'] : null;
        $this->info['extension'] = isset($parts['extension']) ? $parts['extension'] : null;
    }
267456
public function setPath($path)
    {
        if ($this->validatePath($path) === false) {
            require_once 'Zend/Uri/Exception.php';
            throw new Zend_Uri_Exception("Path \"$path\" is not a valid HTTP path");
        }

        $oldPath     = $this->_path;
        $this->_path = $path;

        return $oldPath;
    }
225035
public function readlink($path)
    {
        $result = @ssh2_sftp_readlink($this->sftp, $path);
        if(!$result){
            throw new \Exception("Could get readlink: ".$path);
        }
        return $result;
    }