bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: file-readable-p returns t for empty string


From: Per Abrahamsen
Subject: Re: file-readable-p returns t for empty string
Date: Fri, 01 Mar 2002 10:32:36 +0100
User-agent: Gnus/5.090006 (Oort Gnus v0.06) Emacs/21.1 (i686-pc-linux-gnu)

address@hidden (David Kastrup) writes:

> Well, expanding "" (which would yield an error if you tried it opening
> under any operating system) to ".", an entirely different file, is
> equally absurd.  

It may be absurd, but it is common behavior in many applications.  I
think on the principle of least surprise, "" should either expand to
the current directory, or generate an error.

>From Moscow ML:

   [mkCanonical p] returns a canonical path which is equivalent to p.
   Redundant occurrences of the parent arc, the current arc, and the
   empty arc are removed.  The canonical path will never be the empty
   string; the empty path is converted to the current directory path
   ("." under Unix and DOS).  

Or the man page to cd(1):

   CDPATH
         A colon-separated list of pathnames that refer to
         directories.  If  the  directory operand does not
         begin with a slash ( / ) character, and the first
         component  is  not dot or dot-dot, cd will search
         for directory relative to each directory named in
         the CDPATH variable, in the order listed. The new
         working directory will be set to the first match-
         ing  directory found. An empty string in place of
         a  directory  pathname  represents  the   current
         directory.  If  CDPATH  is  not  set,  it will be
         treated as if it were an empty string.

Or Java

    public static java.lang.String simplifyPath(java.lang.String path)
    
    Generates shortest equivalent path.. 
    
    Details: simplifyPath modifies the given path name to represent the
    path's most natural form. For example,
    
           /usr//bin/../local/./bin/ 
    
    is transformed into
    
           /usr/local/bin . 
    
    Parent directory path components ("..") and current directory path
    components (".") are eliminated wherever possible, and trailing
    slashes and redundant slashes are always removed (except where the
    path is simply "/"). Also, the parent of the root directory is assumed
    to be itself. If the empty string is supplied, the returned path is
    "."




reply via email to

[Prev in Thread] Current Thread [Next in Thread]