示例#1
0
 /**
  * Get potential config directory paths.
  *
  * Returns `~/.psysh`, `%APPDATA%/PsySH` (when on Windows), and all
  * XDG Base Directory config directories:
  *
  *     http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html
  *
  * @return string[]
  */
 public static function getConfigDirs()
 {
     $xdg = new Xdg();
     return self::getDirNames($xdg->getConfigDirs());
 }
 /**
  * Get potential config directory paths.
  *
  * If a `configDir` option was explicitly set, returns an array containing
  * just that directory.
  *
  * Otherwise, it returns `~/.psysh` and all XDG Base Directory config directories:
  *
  *     http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html
  *
  * @return string[]
  */
 protected function getConfigDirs()
 {
     if (isset($this->configDir)) {
         return array($this->configDir);
     }
     $xdg = new Xdg();
     $dirs = array_map(function ($dir) {
         return $dir . '/psysh';
     }, $xdg->getConfigDirs());
     if ($home = $this->getPsyHome()) {
         array_unshift($dirs, $home);
     }
     return $dirs;
 }
示例#3
0
 /**
  * Get potential config directory paths.
  *
  * If a `configDir` option was explicitly set, returns an array containing
  * just that directory.
  *
  * Otherwise, it returns `~/.psysh` and all XDG Base Directory config directories:
  *
  *     http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html
  *
  * @return string[]
  */
 protected function getConfigDirs()
 {
     if (isset($this->configDir)) {
         return array($this->configDir);
     }
     $xdg = new Xdg();
     $dirs = array_map(function ($dir) {
         return $dir . '/psysh';
     }, $xdg->getConfigDirs());
     array_unshift($dirs, $this->getHomeDir() . '/.psysh');
     return $dirs;
 }