help-emacs-windows
[Top][All Lists]
Advanced

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

Re: [h-e-w] Absolute/relative pathnames under nt


From: John McCabe
Subject: Re: [h-e-w] Absolute/relative pathnames under nt
Date: Thu, 30 May 2002 09:11:07 +0100

> Given that ntemacs looks for .emacs in the directory specified by the HOME
> environment variable, it seems odd to me that in ntemacs absolute filenames
> begin with a drive letter, rather than a ~ as in unix. I quote from the
> emacs lisp manual:

> "All the directories in the file system form a tree starting at the root
> directory. A file name can specify all the directory names starting from the
> root of the tree; then it is called an absolute file name. Or it can specify
> the position of the file in the tree relative to a default directory; then
> it is called a relative file name. On Unix and GNU/Linux, an absolute file
> name starts with a slash or a tilde (`~'), and a relative one does not. On
> MS-DOS and MS-Windows, an absolute file name starts with a slash or a
> backslash, or with a drive specification `x:/', where x is the drive letter.
> The rules on VMS are complicated"

But in unix, '~' references the same location as $HOME, i.e. a user's home 
directory, not the root directory. Examples:

~/xxx           - references the node xxx under your home directory
~smith/xxx      - references the node xxx under smith's home directory
/home/smith/xxx - could reference the same node as above

As far as I am aware, the '~' is substituted for the absolute path of the 
user's directory (or selected directory), which is why it is an absolute 
file name and not a relative one. This is a bit more complicated on Windows 
because the filesystem is not seen to the user as a homogeneous mass of 
consistent names. E.g. on Unix, the files:

/home/john/tests/mirror/x.c and /etc/bin/rc.local

have consistent file naming information based on the root directory '/', 
but /home and /etc can be completely different drives. On Windows the 
equivalent would be something like:

c:\john\tests\mirror\x.c and d:\bin\rc.local

i.e. there is no absolute root directory equivalent to '/' in Windows 
(unless you count "My Computer" but that is more of a conceptual root than 
an actual directory).

You also have to consider the possibility of network names like:

\\MYSERVER\SHARE1

On Windows.

> It seems to me that for ntemacs, given that ntemacs needs a home directory
> to be specified via the HOME environment variable,

Well, not quite true because if the HOME variable doesn't exist in Windows, 
NT Emacs will use c:\ as the equivalent (I think).

> and that emacs
> understands the ~ to represent this home directory, that ntemacs should also
> allow absolute filenames to begin with ~ a la unix.

> This would make things a lot easier for eg. using load-file in your .emacs
> for loading files consistently on different platforms etc.

It may be me who's getting confused here, (correct me if I'm wrong) but '~' 
is only absolute because (as I said it above) it is effectively substited 
for an absolute pathname before being used.


Best Regards
John McCabe




reply via email to

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