emacs-devel
[Top][All Lists]
Advanced

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

Re: init_buffer PWD fix


From: 宮下 尚:HIMI
Subject: Re: init_buffer PWD fix
Date: Wed, 24 Apr 2002 16:45:43 +0900
User-agent: T-gnus/6.15.4 (based on Oort Gnus v0.04) (revision 11) SEMI/1.14.3 (Ushinoya) FLIM/1.14.2 (Yagi-Nishiguchi) APEL/10.3 Emacs/21.1 (i386-msvc-nt5.1.2600) MULE/5.0 (SAKAKI) Meadow/1.99 Alpha1 (AWOFUCHI)

Paul Eggert <address@hidden> writes:

> But don't similar issues arise in Windows ports?

I think the answer is "No".

Windows dose not have symbolic link and if the current directory
permission dose not allow to enter, we cannot invoke any programs.

> For example, I know that Windows sometimes plays funky games with
> letter case in file names.  Suppose the user prefers one case for the
> directory name, and sets PWD accordingly.  Won't the user be annoyed if
> Emacs uses the different case returned by getcwd?
> Similarly, suppose the Windows directory has a mangled file name that
> is returned by getcwd, but the user prefers the non-mangled name in
> $PWD.

Unfortunately or fortunately, almost all of Windows programs do not
are "PWD" environment variable.  So we won't obtain better pathname
from "PWD".

And top of that, accoding to my test, GetCurrentDirectory()
holds the straightforward value set by SetCurrentDirectory().
So we don't have to take care of "PWD", and should always use the value of
GetCurrentDirectory().
(Note that GetCurrentDirectory() is W32 API used by getcwd())

You can see the behavior by something like the following code.
--------------------------------------------------------------------------------
#include <windows.h>

int main(int argc, char **argv)
{
  char buf[_MAX_PATH];
  SetCurrentDirectory("c:\\PROGRA~1");
  GetCurrentDirectory(sizeof(buf), buf);
  printf ("GetCurrentDirectory1:%s\n", buf);
  SetCurrentDirectory("c:\\Program Files");
  GetCurrentDirectory(sizeof(buf), buf);
  printf ("GetCurrentDirectory2:%s\n", buf);
}
--------------------------------------------------------------------------------

> Also, are permissions problems ever an issue on Windows platforms?  In
> Unix and GNU/Linux, getcwd can fail because a parent directory is not
> readable, and that is an argument for preferring $PWD to getcwd.  Is
> such a getcwd failure possible in Windows?

If it is, we cannot invoke Emacs because CreateProcess() API would fail. ;-)

from himi




reply via email to

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