I always set $HOME as 'c:/docume~1/mattn' to avoid strange behavior of unix like tools on windows.
But it make a bug that fnamemodify(expand('~/vimfiles'), ':p:8') don't return '~/vimfiles'.
About argument 'src' in home_replace, it will be passed as full path. So homedir_env should be converted full path before comparing.
https://gist.github.com/2412113
Please check and include.
Thanks, I'll check it out later.
--
The early bird gets the worm. If you want something else for
breakfast, get up later.
/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
Why use the GetLongPathName function? It's not used anywhere in Vim.
Can we use vim_FullName() with the force argument set to TRUE?
I suppose this is only needed for MS-Windows. Since expanding a path is
expensive we might first check if the "~" character appears in the
string.
--
ARTHUR: Listen, old crone! Unless you tell us where we can buy a shrubbery,
my friend and I will ... we will say "Ni!"
CRONE: Do your worst!
"Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD
You are right. Thanks.
vim_FullName can't get original filename.
'c:/docume~1/mattn' is full path. And GetFullPathName don't expand short name.
I had another issue even if my patch is included.
If user make Dictionary that has keys of loaded script filename, I guess the user hope to normalize filename, i.e. key of the dict. They will use ":scriptnames" show up messages. But it's relative names from ~/. And, <sfile> return full path (but not long path). Currently vim doesn't provide way to convert short filename to long filename. Then, it may duplicate entries.
I'm finding way to fix this problem.
No.
:echo fnamemodify('C:\Program Files', ':8:p')
C:\PROGRA~1
> I can't see a reason someone would need an 8.3 name expanded
> to anything other than its full long path (with :p), or its
> full short path (with :p:8).
What we want is full long path. Currentl, :p don't return long full long path.
> At any rate, :f does not sound a good mnemonic for "short".
Do you prefer :9 or :) ?
I don't know how many bugs about short name in vim.
I found a bug about home_replace() in the first, In next, I found
fnamemodify().
home_replace() is used in :scriptnames, or fnamemodify(x, ':~') or etc.
Or do you mean "You should change subject of this thread" ?
> > What we want is full long path. Currentl, :p don't return
> > long full long path.
>
> That's why I said *if* :p always produced the expanded long
> name, then :p:8 would be all that was needed to produce the
> equivalent short name.
We need long path, not short name. In some times, file name has an
important thing about `What is this`. Short name break them. For example,
:let filename = s:get_vimrc_filename_from_somewhere()
:if filename =~ '[/\][._]vimrc$' " is .vimrc or _vimrc ?
: call s:do_something_about_vimrc()
:endif
If `s:get_vimrc_filename_from_somewhere` return short path name(for example output from external program),
We can't expand long path. Please try following.
:let shortname = fnamemodify('~/.vimrc', ':p:8')
:echo shortname
c:/docume~1/mattn/VIMRC~1
:echo fnamemodify(shortname, ':p')
c:/docume~1/mattn/VIMRC~1
Then, the code above don't pass into doing `s:do_something_about_vimrc`. And also, we can't know .vimrc become 'vimrc~1' or 'vimrc~2' or others in 8.3 format rules.
> If :p produced the expanded long path, would there be a need for
> any further changes? Why?
I didn't answer for bram's question yet(About whether need to add new modifier or not).
I don't want to change behavior of :p. And I want to add new modifier to expand short name. We can call resolve() in manually, we can call fnamemodify() too.
Bram, how do you think?
Sorry for delay.
https://gist.github.com/2832022
I wonder whether we should change :p behavior. I'm thinking there are some cases to use "8.3". For example, 8.3 don't have spaces in the path. So it's useful to avoid any bugs when executing external program.
I applied this patch above, But some vim plugins occur error. That beleave fnamemodify(tempname(), ':p') dont contains any spaces.
So I suggest one more another patch.
https://gist.github.com/2831996
This is new modifier ":f". User can manually handing "8.3" path names.
If you allow this, I'll add patch for doc.
Thanks.
I updated patch.
https://gist.github.com/2936050
Previous were broken memory.