Thursday, August 9, 2018

Re: Avoid "auto" short paths

Hi,

2018/8/10 Fri 5:09:25 UTC+9 Bram Moolenaar wrote:
> > This is the company environment, is very common users have they own disk
> > areas at the network of the company, which usually is a drive mapping and
> > set at HOMEDRIVE and HOMEPATH.
>
> So HOMEDRIVE and HOMEPATH are always set? Then these should be used,
> they are checked before USERPROFILE.
>
> > When I open the file , at %USERPROFILE% which is my local drive , vim
> > internally change the path references from c:\Users\cinacio (%USERPROFILE%)
> > to "~" .
> > But when vim expand "~" and exists HOMEDRIVE and HOMEPATH set, they use it.
> >
> > I know I can force my HOME setting %HOME%=3D%USERPROFILE% at windows
> > environment.
> > But I have others programs at my desktop and I don't know how this can
> > affect them, so I would to avoid set the %HOME%
> >
> > That's why I would force vim works always with absolute path.
>
> When HOMEDRIVE and HOMEPATH are set, then USERPROFILE should not be
> used. Are you saying that HOMEDRIVE and HOMEPATH are sometimes not set?
> That effectively means your home directory moves around, so it's
> expected that Vim doesn't handle that.
>
> Using an absolute path has the opposite effect: If your home directory
> is on a dynamically mounted drive, the drive letter can change while
> it's still the same directory. Then using "~/" is actually avoiding
> problems. Thus we can't use the full path as a default.
>
> I think having to set $HOME is acceptable.

I found inconsistency in misc1.c.

init_homedir() initialises the static variable homedir by checking the
following environment variables:

1. HOME
2. HOMEDRIVE + HOMEPATH
3. USERPROFILE

And vim_getenv("HOME") returns a value with the homedir variable.
However home_replace() uses mch_getenv("HOME") and it doesn't uses
vim_getenv("HOME") nor homedir.

Maybe home_replace() should use homedir instead of mch_getenv("HOME")?

Regards,
Ken Takata

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment