with specified relative file, 使用指定的相对日志文件名，相对于logger的path
@param  string  $file
@param  boolean $reset if reset log file
@return static
552317
public function withFile($file, $reset=false)
    {
        $file = str_replace('\\', '/', $file);
        if ($pos = strripos($file, $this->getOption('file_ext'))) {
            $file = substr($file, 0, $pos-1);
        }
        $dir = dirname($file);
        if (!isset(static::$instances[$dir])) {
            $instance = new static($this->options);
            $instance->setOption('file', $file);
            static::$instances[$dir] = $instance;
        }
        
        if ($reset) {
            $key = static::$instances[$dir]->getOption('file');
            static::$instances[$dir]->remove($key);
            static::$instances[$dir]->remove($key . '.error');
        }
        
        return static::$instances[$dir];
    }
570876
public static function file( $file )
	{
		$params = array_merge( static::$params, array(
			'time' => time(),
			'fingerprint' => \CCSession::fingerprint(),
			'random' => CCStr::random(),
		));
		
		foreach( $params as $param => $value )
		{
			$file = str_replace( ':'.$param, $value, $file );
		}
		
		return $file;
	}
1115054
public function share($file)
    {
        $mapping = $this->config->get('remote.directories');

        // Get path to current file and shared file
        $currentFile = $this->releasesManager->getCurrentReleasePath($file);
        $sharedFile = preg_replace('#'.$mapping['releases'].'/[0-9]+/#', $mapping['shared'].'/', $currentFile);

        // If no instance of the shared file exists, use current one
        if (!$this->modulable->fileExists($sharedFile)) {
            $this->modulable->move($currentFile, $sharedFile);
        }

        $this->explainer->line('Sharing file '.$currentFile);

        return $this->modulable->symlink($sharedFile, $currentFile);
    }
484474
public static function compassResolvePath($file)
	{
		if ($file{0}=='/') {
			return $file;
			}
		if (!$path=realpath($file)) {
			$path=\PHPSass\Script\ScriptFunction::$context->node->token->filename;
			$path=substr($path, 0, strrpos($path, '/')).'/';
			$path=$path.$file;
			$last='';
			while ($path!=$last) {
				$last=$path;
				$path=preg_replace('`(^|/)(?!\.\./)([^/]+)/\.\./`', '$1', $path);
				}
			$path=realpath($path);
			}
		if ($path) {
			return $path;
			}

		return FALSE;
	}
392974
public function fromFile($file)
    {
        try {
            $data = file_get_contents($file);
            if ($data !== false) {
                return $this->parser->parse($data);
            }
            throw new \InvalidArgumentException("file could not be loaded");
        } catch (\Exception $e) {
            throw new \InvalidArgumentException("file could not be loaded (" . $e->getMessage() . ")");
        }
    }
195551
public function writeLog(string $file, $msg, bool $raw = false): void
    {
        //是否允许记录开发人员日志
        configDefault(false, 'log', 'writeLog') ? $this->log($file, $msg, $raw) : null;
    }
454792
public function getRelatedFiles($file, $default = [])
    {
        $this->readMetadataFile();

        return isset($this->metadata[$file]['rel']) ? $this->metadata[$file]['rel'] : $default;
    }
755531
public function loadConfigFile($file, $env = null)
    {
        $file = str_replace('%env%', $env ?: $this->name, $file);
        $config = $this->getFileConfig($file);
        if ($config) {
            $this->wei->setConfig($config);
        }
        return $this;
    }
175853
public function url($reset = true)
    {
        $output = preg_replace('|^' . preg_quote(GRAV_ROOT, '|') . '|', '', $this->get('filepath'));

        $locator = Grav::instance()['locator'];
        if ($locator->isStream($output)) {
            $output = $locator->findResource($output, false);
        }

        if ($reset) {
            $this->reset();
        }

        return trim(Grav::instance()['base_url'] . '/' . $this->urlQuerystring($output), '\\');
    }
770203
public function resolve($file)
    {
        $info = null;

        $this->rewind();
        foreach (clone $this as $path) {
            $info = new SplFileInfo(rtrim($path, '/') . '/' . ltrim($file, '/'));

            if ($info->isDir() || $info->isFile() || $info->isLink()) {
                break;
            }
        }

        return ($info)? $info->getPathname() : null;
    }
785155
public function setLogFile($logFile)
    {
        if (strpos($logFile, '://') === false) {
            if (!GeneralUtility::isAbsPath($logFile)) {
                $logFile = PATH_site . $logFile;
            }
        }

        $this->logFile = $logFile;
        $this->openLogFile();

        return $this;
    }
865878
public function setFile($file = null)
    {
        if (is_null($file)) {
            $this->file = ['name' => date('Ymd-His'), 'part' => 1];
        } else {
            if (!array_key_exists("name", $file) && !array_key_exists("part", $file)) {
                $this->file = $file['1'];
            } else {
                $this->file = $file;
            }
        }
        return $this;
    }
593804
public function rmFile($file)
    {

        if (!is_file($file)) {
            $this->errorMsg = "this is not a file";
            return false;
        }
        if (unlink($file)) {
            return true;
        } else {
            $this->errorMsg = "fail to remove the file!";
            return false;
        }
    }
1144098
public static function readConfigFile($file = self::DEFAULT_CONFIG_FILE)
    {
        if (!is_string($file)) {
            throw new InvalidArgumentException('The config file path must be a string, type passed "'.gettype($file).'".');
        }

        $baseDir = realpath(dirname($file));
        $searchDirs = array(
            $baseDir.'/',
            $baseDir.'/../',
            $baseDir.'/../../',
            $baseDir.'/config/',
            $baseDir.'/../config/',
            $baseDir.'/../../config/'
        );

        $filename = basename($file);

        $configFile = null;
        foreach ($searchDirs as $dir) {
            if (realpath($dir.$filename) and is_readable($dir.$filename)) {
                $configFile = realpath($dir.$filename);
                break;
            }
        }

        if (is_null($configFile) and $file !== self::DEFAULT_CONFIG_FILE) {
            throw new InvalidArgumentException('The config file "'.$file.'" cannot be found or read.');
        }

        if (!$configFile) {
            return static::$config;
        }

        // Try to parse the contents
        try {
            $yaml = Yaml\Yaml::parse(file_get_contents($configFile));
        } catch (Yaml\Exception\ParseException $e) {
            throw new Exception('Unable to parse the config file: '.$e->getMessage());
        }

        return static::$config = $yaml;
    }
276777
public function setFile(File $file)
    {
        $this->file = $file;

        if ($this->file) {
            $this->updatedAt = new \DateTime('now');
        }

        return $this;
    }
1119406
final public function getPath($file = "", $default = null)
    {

        $file = (empty($file) && isset($this->file)) ? $this->file : $file;

        if (empty($file)) {
            return $default;
        }

        //Determine the file extension
        return pathinfo($file, PATHINFO_DIRNAME);
    }
1285677
public static function reloadCfg($config, $file = false) {
        $app = self::$app;
        unset($app->configs[ $config ]);

        return self::config($config, $file);
    }