[Top][All Lists]

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

Re: file-truename, convert-standard-filename

From: Eli Zaretskii
Subject: Re: file-truename, convert-standard-filename
Date: Fri, 05 Feb 2010 21:04:06 +0200

> From: "Drew Adams" <address@hidden>
> Date: Fri, 5 Feb 2010 09:31:54 -0800
> It's not clear to me when to use `file-truename' and
> `convert-standard-filename'.
> I understand from the doc that:
> * f-t gives a name that results from following symlinks (including through
> ancestor dirs). 
> * c-s-f gives a file name that fits the current OS. (So if a name is intended 
> to
> be independent of a particular OS, it should not be the result of calling
> c-s-f.)

`convert-standard-filename' is for file names embedded as literal
strings within Emacs sources.

On Windows, `file-truename' also converts a short 8+3 alias into its
long original.  So, for example, `C:/DOCUME~1/USER/LOCALS~1/Temp' is
converted into `C:/Documents and Settings/USER/Local Settings/Temp'.
It also converts the letter-case to what is actually recorded in the

> But in terms of use, if I want to, say, compare two file names to see if they
> represent the same file, what's typically appropriate?

Using `file-truename' should be enough.  If you compare against a
literal string that holds a name of a file mentioned in Emacs sources,
such as ".emacs" or ".desktop", run them through
`convert-standard-filename' first.  As Andreas points out, an existing
file should not be subject to `convert-standard-filename'.

> Grepping the Emacs
> sources didn't make any guidelines jump to my eyes. For defcustoms, for
> instance, sometimes f-t is used; sometimes c-s-f is used.

Which defcustoms use `file-truename'?

reply via email to

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