/*
returns the FileSystem of the path. If the FileSystem is down, then
log an error and return null
436690
static FileSystem getFs(Configuration conf, Path p) {
    try {
      return p.getFileSystem(conf);
    } catch (Exception e) {
      // if a single namenode is down, log it and ignore. Continue to
      // fix other namenodes.
      LOG.warn("getFs: Unable to contact filesystem: " + p + " ignoring.... " +
               e);
      e.printStackTrace();
      return null;
    }
  }
702707
function (logicalPath) {
            var itm = this._cache.getItem("files", logicalPath, false);
            if (itm && itm.status == this._cache.STATUS_AVAILABLE) {
                return itm.value;
            }
            return null;
        }
698370
public static function getFileSystem()
    {
        if (self::$fs === null) {
            switch (Phing::getProperty('host.fstype')) {
                case 'UNIX':
                    self::$fs = new UnixFileSystem();
                    break;
                case 'WINDOWS':
                    self::$fs = new WindowsFileSystem();
                    break;
                default:
                    throw new IOException("Host uses unsupported filesystem, unable to proceed");
            }
        }

        return self::$fs;
    }
669349
def abspath(self, path):
        """"""

        def getcwd():
            """Return the current working directory."""
            # pylint: disable=undefined-variable
            if IS_PY2 and isinstance(path, text_type):
                return self.os.getcwdu()
            elif not IS_PY2 and isinstance(path, bytes):
                return self.os.getcwdb()
            else:
                return self.os.getcwd()

        path = make_string_path(path)
        sep = self.filesystem._path_separator(path)
        altsep = self.filesystem._alternative_path_separator(path)
        if not self.isabs(path):
            path = self.join(getcwd(), path)
        elif (self.filesystem.is_windows_fs and
              path.startswith(sep) or altsep is not None and
              path.startswith(altsep)):
            cwd = getcwd()
            if self.filesystem._starts_with_drive_letter(cwd):
                path = self.join(cwd[:2], path)
        return self.normpath(path)
264084
function (path) {
        if (path[path.length - 1] === '/') {
            path = path.substr(0, path.length - 1);
        }
        return path;
    }
68323
public function path(){

        $args = \func_get_args();

        switch (\count($args)){

            case 1:

                $file  = $args[0];

                if ($this->isAbsolutePath($file) && \file_exists($file)) {
                    return $file;
                }

                $parts = \explode(':', $file, 2);

                if (count($parts)==2){
                    if (!isset($this->paths[$parts[0]])) return false;

                    foreach ($this->paths[$parts[0]] as &$path){
                        if (\file_exists($path.$parts[1])){
                            return $path.$parts[1];
                        }
                    }
                }

                return false;

            case 2:

                if (!isset($this->paths[$args[0]])) {
                    $this->paths[$args[0]] = [];
                }
                \array_unshift($this->paths[$args[0]], \rtrim(\str_replace(DIRECTORY_SEPARATOR, '/', $args[1]), '/').'/');

                return $this;
        }

        return null;
    }
834166
private FileStatus[] getFileStatus(Path[] paths) throws IOException {
    if (paths == null) {
      return null;
    }
    ArrayList<FileStatus> results = new ArrayList<FileStatus>(paths.length);
    for (int i = 0; i < paths.length; i++) {
      try {
        results.add(getFileStatus(paths[i]));
      } catch (FileNotFoundException e) { // do nothing
      }
    }
    return results.toArray(new FileStatus[results.size()]);
  }
1229022
private Archive<?> getArchive(final Path path) {
        assert path != null : "Path must be specified";
        final FileSystem fs = path.getFileSystem();
        assert fs != null : "File system is null";
        // Could be user error in this case, passing in a Path from another provider
        if (!(fs instanceof ShrinkWrapFileSystem)) {
            throw new IllegalArgumentException("This path is not associated with a "
                + ShrinkWrapFileSystem.class.getSimpleName());
        }
        final ShrinkWrapFileSystem swfs = (ShrinkWrapFileSystem) fs;
        final Archive<?> archive = swfs.getArchive();
        assert archive != null : "No archive associated with file system";
        return archive;
    }
218270
public Path getParent() {
    String path = uri.getPath();
    int lastSlash = path.lastIndexOf('/');
    int start = hasWindowsDrive(path, true) ? 3 : 0;
    if ((path.length() == start) ||               // empty path
        (lastSlash == start && path.length() == start+1)) { // at root
      return null;
    }
    String parent;
    if (lastSlash==-1) {
      parent = CUR_DIR;
    } else {
      int end = hasWindowsDrive(path, true) ? 3 : 0;
      parent = path.substring(0, lastSlash==end?end+1:lastSlash);
    }
    return new Path(uri.getScheme(), uri.getAuthority(), parent);
  }
1145129
public synchronized FileSystem getFs() throws IOException {
    if (this.fs == null) {
      Path sysDir = getSystemDir();
      this.fs = sysDir.getFileSystem(getConf());
    }
    return fs;
  }
768404
@GuardedBy("monitor")
  private /*@Nullable*/ TreeNode findNode(/*@Nullable*/ String path) {
    if (Strings.isNullOrEmpty(path) || "/".equals(path)) { // Go back to the root directory.
      return root;
    } else {
      List<String> dirs = PATH_SPLITTER.splitToList(path);
      TreeNode node = root;
      for (int i = 0; i < dirs.size(); i++) {
        String dir = dirs.get(i);
        if ("".equals(dir) && i == 0) {
          continue; // Skip the first "", the path of root node.
        }
        if (!node.children.containsKey(dir)) {
          return null;
        } else {
          node = node.children.get(dir);
        }
      }
      return node;
    }
  }
529550
function() {

        return Q.all(this.tech
            .getPaths(PATH.resolve(this.root, this.output), this.tech.getBuildSuffixes())
            .map(function(path) {

                return QFS.lastModified(path)
                    .fail(function() {
                        return -1;
                    });

            }))
            .spread(Math.min);

    }
1240299
public function getFilesystemPaths()
    {
        return array_map(
            function (FilesystemResource $resource) {
                return $resource->getFilesystemPath();
            },
            array_filter(
                $this->toArray(),
                function (PuliResource $r) {
                    return $r instanceof FilesystemResource && null !== $r->getFilesystemPath();
                }
            )
        );
    }
364664
function() {
      var path = this.decodeFragment(this.location.pathname);
      var rootPath = path.slice(0, this.root.length - 1) + '/';
      return rootPath === this.root;
    }
281861
public function getFileSystem() {
    if (empty($this->fileSystem)) {
      $this->fileSystem = \Drupal::service('file_system');
    }
    return $this->fileSystem;
  }
716753
async function getTrueFilePath(p) {
  let fsPathNormalized = p;
  // OSX: HFS+ stores filenames in NFD (decomposed normal form) Unicode format,
  // so we must ensure that the input path is in that format first.
  if (process.platform === 'darwin')
    fsPathNormalized = fsPathNormalized.normalize('NFD');

  // !! Windows: Curiously, the drive component mustn't be part of a glob,
  // !! otherwise glob.sync() will invariably match nothing.
  // !! Thus, we remove the drive component and instead pass it in as the 'cwd'
  // !! (working dir.) property below.
  const pathRoot = parse(fsPathNormalized).root;
  const noDrivePath = fsPathNormalized.slice(Math.max(pathRoot.length - 1, 0));

  // Perform case-insensitive globbing (on Windows, relative to the drive /
  // network share) and return the 1st match, if any.
  // Fortunately, glob() with nocase case-corrects the input even if it is
  // a *literal* path.
  const result = await glob(noDrivePath, { nocase: true, cwd: pathRoot });
  return result[0];
}
103237
@Nullable
  private FileStatus[] listStatusInternal(String path) throws IOException {
    FileStatus[] files;
    FileSystem hdfs = getFs();
    try {
      files = hdfs.listStatus(new Path(path));
    } catch (FileNotFoundException e) {
      return null;
    }
    // Check if path is a file
    if (files != null && files.length == 1 && files[0].getPath().toString().equals(path)) {
      return null;
    }
    return files;
  }