Build a new server structure on the given directory
@param string $serverPath directory of the new server
@return boolean successfully builded?
171549
function (serverPath)
		{
			if (!_.isString(serverPath))
				return false;

			var _sourcePath = cwd+sourcePath,
				relativeSourcePath = path.relative(serverPath,_sourcePath)+'/',
				relativeServerPath = path.relative(cwd,serverPath);

			self.e.log("[*] Building new wnServer on `"+serverPath+"`");

			if (!fs.existsSync(serverPath))
				fs.mkdirSync(serverPath);

			self.e.log("[*] - Creating new `package.js` file.");
			var defaultPackage = fs.readFileSync(_sourcePath+'/default-package.json').toString('utf8');
			defaultPackage = (defaultPackage+'').replace(/\{moduleName\}/g, 'server-'+serverPath.substr(0,serverPath.length-1).split('/').pop().replace(/\s/g,'-'));
			fs.writeFileSync(serverPath+'/package.json',defaultPackage);

			self.e.log("[*] - Creating new `config.json` file.");
			fs.writeFileSync(serverPath+'/config.json',
				fs.readFileSync(_sourcePath+'/default-config.json')
			);

			self.e.log("[*] - Creating new `index.js` file.");
			var defaultIndex = fs.readFileSync(_sourcePath+'/default-index.js').toString('utf8');
			defaultIndex = defaultIndex.replace(/\{sourcePath\}/g,'./'+relativeSourcePath.replace(/\\/g,'/'));
			defaultIndex = defaultIndex.replace(/\{serverPath\}/g,'./'+relativeServerPath.replace(/\\/g,'/'));
			fs.writeFileSync(serverPath+'/index.js',defaultIndex);

			self.e.log('[*] New wnServer created.');

			return true;
		}
863772
public function getServerPath()
    {
        if (is_null($this->_serverPath)) {
            $this->_resourceTypeConfig = $this->getResourceTypeConfig();
            $this->_serverPath = CKFinder_Connector_Utils_FileSystem::combinePaths($this->_resourceTypeConfig->getDirectory(), ltrim($this->_clientPath, "/"));
        }

        return $this->_serverPath;
    }
205751
public function open($savePath, $sessionName): bool
    {
        $this->savePath = $savePath;
        Directory::create($this->savePath);
        return true;
    }
1275619
private function createPathIfNeeded(string $path) : bool
    {
        if (! is_dir($path)) {
            if (@mkdir($path, 0777 & (~$this->umask), true) === false && ! is_dir($path)) {
                return false;
            }
        }

        return true;
    }
618442
function buildFromDirectory(dirPath){
	var dbsetPath = path.join(dirPath,"dbsets");
	if(fileutil.isExist(dbsetPath)){
		defaultConfig['dbsets'] = dbsetPath;
	}

	var stubsPath = path.join(dirPath,"stubs");
	if(fileutil.isExist(stubsPath)){
		defaultConfig['stubs'] = stubsPath;
	}

	var dumpsPath = path.join(dirPath,"dumps");
	if(fileutil.isExist(dumpsPath)){
		defaultConfig['dumps'] = dumpsPath;
	}

	var mappingsPath = path.join(dirPath,"mappings");
	var files = fileutil.ls(mappingsPath);
	if(files.length > 0){
		defaultConfig['mappings']['requests'] = [];
		files.forEach(function(filename){
			defaultConfig['mappings']['requests'].push(path.join(mappingsPath , filename));
		});
	}

	var trustStorePath = path.join(dirPath,"truststore");
	if(fileutil.isExist(trustStorePath)){
		defaultConfig.server.key = path.join(trustStorePath , "server.key");
		defaultConfig.server.cert = path.join(trustStorePath , "server.crt");

		var cacertPath = path.join(trustStorePath,"ca");
		var cacerts = fileutil.ls(cacertPath);

		if(cacerts.length > 0){
			defaultConfig.server.ca = [];
			cacerts.forEach(function(filename){
				defaultConfig.server.ca.push(path.join(cacertPath , filename));
			});
		}
	}
}
1298916
public function createDirectory($dirPath)
    {
      if (! $this->fs->exists($dirPath))
      {
        $this->fs->mkdir($dirPath);
      }
    }
37882
public function templatePath($templatePath = false)
    {
        if ($templatePath === false) {
            return $this->_templatePath;
        }

        $this->_templatePath = $templatePath;

        return $this;
    }
1087834
private function setTemplatePath($templatePath)
  {
    $return = false;

    if (is_string($templatePath)) {
      if ($this->checkTemplatePath($templatePath) === true) {
        $this->templatePath[] = $templatePath;

        $return = true;
      }
    }
    else if (is_array($templatePath)) {
      foreach ($templatePath as $path) {
        if ($this->checkTemplatePath($path) === true) {
          $this->templatePath[] = $path;

          $return = true;
        }
      }
    }

    return $return;
  }
280182
public function addPath($basepath)
    {
        foreach (new DirectoryIterator($basepath) as $dir) {
            if ($dir->isDir() && !$dir->isDot()) {
                $lang = $dir->getBasename();
                $path = $dir->getPathname();

                if (!isset($this->paths[$lang])) {
                    $this->paths[$lang] = [];
                }

                if (!in_array($path, $this->paths[$lang])) {
                    $this->paths[$lang] = $path;
                }

                // 新增加的目录，需要重新扫描已加载的语言包
                $this->load($lang, $path, [$lang] + $this->packages);
            }
        }

        return $this;
    }
833338
public static function build(ServerInterface $server)
    {
        if ($server instanceof SftpServer) {
            return new SftpFile($server);
        } elseif ($server instanceof FtpServer || $server instanceof SslServer) {
            return new FtpFile($server);
        } else {
            throw new \InvalidArgumentException('The argument is must instance of server class');
        }
    }
1280965
protected function createDirectory($dirPath)
    {
        // $fullPath = $this->app->config()['paths']['root']->expand($dirPath);
        
        if (!is_dir($dirPath)) {
            $this->output->writeln(sprintf(
                "<info>create  <cyan>%s</cyan></info>",
                $this->prettyPath($dirPath)
            ));
            mkdir($dirPath, 0775, true);
        }
    }
368461
public function uploadFile(string $dirPath, string $fileName): bool
    {
        try {
            if (!$this->filesystem->createDir($dirPath)) {
                return false;
            }

            $targetFilePath = $dirPath . DIRECTORY_SEPARATOR . $fileName;

            if ($this->filesystem->has($targetFilePath)) {
                $this->addError('', "File by path `{$targetFilePath}` already exists.");

                return false;
            }

            $contentResource = $this->getFileContent();
            if ($contentResource === null) {
                return false;
            }

            return $this->filesystem->writeStream($targetFilePath, $contentResource);
        } catch (\Exception $e) {
            return false;
        }
    }
497206
protected function initBaseDir($basePath)
    {
        if ($basePath) {
            $this->setBaseDir($basePath);
        } elseif (defined('BASE_PATH')) {
            $this->setBaseDir(BASE_PATH);
        } else {
            throw new BadMethodCallException("No BASE_PATH defined");
        }
    }
982552
protected function serverRequest($path, $context)
	{
		if (strpos($path, '/') === 0)
		{
			$path = substr($path, 1);
		}

		$url = sprintf('http://%s/%s', $this->serverUrl, $path);

		$context = stream_context_create($context);
		$result = @file_get_contents($url, false, $context);

		if ($result === false)
		{
			throw new ClientException('Failed connecting to ' . $url);
		}

		if (($result = json_decode($result)) === false)
		{
			throw new ClientException("Failed decoding json response from server");
		}

		if (empty($result))
		{
			throw new ClientException("Did not receive a valid client instance");
		}

		return $result;
	}
749716
function (serverPath,relativeMainPath)
		{
			if (relativeMainPath)
				serverPath = path.relative(cwd,path.resolve(mainPath,serverPath));

			var serverConfig = {},
				consoleID = this.getServerModules().length+1;
				serverConfig[consoleID] = { 'modulePath': serverPath, 'serverID': consoleID };

			this.e.log('[*] Building wnServer from `'+serverPath+'`');

			if (!fs.existsSync(this.modulePath+serverPath))
			{
				this.e.log('[*] Failed to load wnServer from path.');
				return false;
			}
		
			this.setServers(serverConfig);
			var server = this.createServer(consoleID);

			this.selectServer(consoleID);

			return server;
		}
987615
public function create($filepath, $mode = "w")
    {
        //@1 Fopen cannot create directories,
        //so if trying to create a file in subfolders that don't exist will throw a warning
        //wewill first create these directories;
        $dirname = dirname($filepath);

        if (!is_dir($dirname)) {
            if (mkdir($dirname, 0755, true)) {
                return $dirname;
            } else {
                return false;
            }
        }

        //@2 Attempt to create the file
        if (!($file = $this->getFileStream($filepath, $mode))) {
            return false;
        }

        return $file;
    }
794358
public static function makeGoodPathServer($path)
    {

        $path = (string)$path;
        $path = str_replace(['\\', '/',], DIRECTORY_SEPARATOR, $path);

        return $path;
    }