requested file / link, and the last entry the canonical file.
548831
private List<Path> linkTargets(Path link) throws IOException {
        link = link.toAbsolutePath();

        List<Path> out = new ArrayList<>();
        out.add(link);

        if (Files.isSymbolicLink(link.getParent())) {
            Path target = link.getParent()
                              .getParent()
                              .resolve(Files.readSymbolicLink(link.getParent()))
                              .resolve(link.getFileName())
                              .toAbsolutePath();
            out.addAll(linkTargets(target));
        } else if (Files.isSymbolicLink(link)) {
            Path target = link.getParent()
                              .resolve(Files.readSymbolicLink(link))
                              .toAbsolutePath();
            out.addAll(linkTargets(target));
        } else {
            // Then resolve the rest.
            Path canonical = readCanonicalPath(link);
            if (!canonical.equals(link)) {
                out.add(canonical);
            }
        }

        return out;
    }
103669
def add_last_closed_file(self, fname):
        """"""
        if fname in self.last_closed_files:
            self.last_closed_files.remove(fname)
        self.last_closed_files.insert(0, fname)
        if len(self.last_closed_files) > 10:
            self.last_closed_files.pop(-1)
758448
def _make_canonical_uri(parsed):
    
    path = urllib.quote(parsed.path)
    canonical_parsed = parsed._replace(path=path,
                                       params='', query='', fragment='')
    return urlparse.urlunparse(canonical_parsed)
666232
def link(self):
    """"""
    if self._link is None:
      self._link = ''

      if not self.IsLink():
        return self._link

      location = getattr(self.path_spec, 'location', None)
      if location is None:
        return self._link

      self._link = os.readlink(location)
      self._link = os.path.abspath(self._link)
    return self._link
765699
function() {
			// remove any query string
			var cleaned = this.clean(),
				// get the last /
				last = cleaned.lastIndexOf('/'),
			    // if there is a last /, get everything up to that point
				dir = (last != -1) ? cleaned.substring(0, last) : '';
			// make sure we aren't left with just https/ or file:/
			return /^(https?:\/|file:\/)$/.test(dir) ? cleaned : dir;
		}
726598
def get_url_file_ext(url):
    """"""
    # get the last part of the path component
    filename = url.split('/')[-1]
    name, ext = os.path.splitext(filename)

    # handle case of files with leading dot
    if not ext and name and name[0] == '.':
        ext = name

    return ext
80470
protected String linkToFile(File f) {
        String url = getWikiUrl(f.getAbsolutePath());
        if (url == null) {
            url = f.toURI().toString();
        }
        return String.format("<a href=\"%s\" target=\"_blank\">%s</a>", url, f.getName());
    }
477059
function finalizeSection() {
            if (lastSectionDoc) {
                self._$headers[lastSectionDoc.file.fullPath].append(" (" + numItemsInSection + ")");
                if (self._collapsedFiles[lastSectionDoc.file.fullPath]) {
                    self._toggleSection(lastSectionDoc.file.fullPath, true);
                }
            }
        }
1058452
def GetLinkedFileEntry(self):
    
    link = self._GetLink()
    if not link:
      return None

    path_spec = os_path_spec.OSPathSpec(location=link)
    return OSFileEntry(self._resolver_context, self._file_system, path_spec)
146407
void linkLast(final E e) {
    final E l = last;
    last = e;

    if (l == null) {
      first = e;
    } else {
      setNext(l, e);
      setPrevious(e, l);
    }
  }
132074
public Entry getLast()
  {
    if (tc.isEntryEnabled())
    {
      SibTr.entry(tc, "getLast");     
      SibTr.exit(tc, "getLast", last);
    }

    return last;
  }
538529
def _open_next(self):
        """"""

        # is the file split over archives?
        if (self._cur.flags & rarfile.RAR_FILE_SPLIT_AFTER) == 0:
            return False

        if self._fd:
            self._fd.close()
            self._fd = None

        # open next part
        self._volfile = self._parser._next_volname(self._volfile)
        fd = rarfile.XFile(self._volfile)
        self._fd = fd
        sig = fd.read(len(self._parser._expect_sig))
        if sig != self._parser._expect_sig:
            raise rarfile.BadRarFile("Invalid signature")

        # loop until first file header
        while 1:
            cur = self._parser._parse_header(fd)
            if not cur:
                raise rarfile.BadRarFile("Unexpected EOF")
            if cur.type in (rarfile.RAR_BLOCK_MARK, rarfile.RAR_BLOCK_MAIN):
                if cur.add_size:
                    fd.seek(cur.add_size, 1)
                continue
            if cur.orig_filename != self._inf.orig_filename:
                raise rarfile.BadRarFile("Did not found file entry")
            self._cur = cur
            self._cur_avail = cur.add_size
            return True
307691
def _open(self, path, skip_to_end = True, offset = None):
      """"""
      fh = os.fdopen(os.open(path, os.O_RDONLY | os.O_NONBLOCK))

      # If the file is being opened for the first time, jump to the end.
      # Otherwise, it is being reopened after a rotation, and we want
      # content from the beginning.
      if offset is None:
         if skip_to_end:
            fh.seek(0, 2)

            self._offset = fh.tell()
         else:
            self._offset = 0
      else:
         fh.seek(offset)
         self._offset = fh.tell()
      
      self._fh = fh
      self._lastsize = fh.tell()
      self._inode = os.stat(self._path).st_ino
1272244
def canonical_key(self, key):
        """"""
        if key.startswith('/'):
            return urlparse.urljoin(self.base_uri, key)
        else:
            return self.curies.expand(key)
642335
def postprocess_link(self, entry):
        

        if not self.follow_links:
            return

        if type(entry.link) is not list:
            entry.link = [entry.link]

        for link in list(entry.link):
            if not os.path.exists(link):
                continue

            mime_type = magic.from_file(link, mime=True)
            if mime_type == 'application/pdf':
                structuredfeature = extract_pdf(link)
            elif mime_type == 'text/plain':
                structuredfeature = extract_text(link)
            else:
                structuredfeature = None

            if not structuredfeature:
                continue

            fset_name = mime_type.split('/')[-1] + '_text'
            if not fset_name in self.full_text:
                self.full_text[fset_name] = {}

            if hasattr(self, 'index_by'):
                ident = getattr(entry, self.index_by)
                if type(ident) is list:
                    ident = ident[0]
            else:   # If `index_by` is not set, use `uri` by default.
                ident = entry.uri

            self.full_text[fset_name][ident] = structuredfeature
383354
public static File getLastFile() {
        Preferences preferences = Preferences.userRoot().node(GuiBridgeHandler.PREFS_NODE_NAME);

        String userHome = System.getProperty("user.home");
        String lastPath = preferences.get(LAST_PATH, userHome);
        File file = new File(lastPath);
        if (!file.exists()) {
            return new File(userHome);
        }
        return file;
    }
1258146
def include_end(self):
        
        self.lex = self.filestack[-1][2]
        self.input_data = self.filestack[-1][3]
        self.filestack.pop()

        if not self.filestack:  # End of input?
            return

        self.filestack[-1][1] += 1  # Increment line counter of previous file

        result = lex.LexToken()
        result.value = self.put_current_line(suffix='\n')
        result.type = '_ENDFILE_'
        result.lineno = self.lex.lineno
        result.lexpos = self.lex.lexpos

        return result