diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2017-05-15 02:12:52 +0200 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2017-05-15 15:01:52 +0200 |
commit | 5bda5c5bf2e163657b3846a4aeeb9449de4b9c1a (patch) | |
tree | 189f69bc9b4cef7c479b46ad69b62bd2b6119324 | |
parent | 4c5398bc402357468ccb4dfc07d6867a44c18a23 (diff) | |
download | rneovim-5bda5c5bf2e163657b3846a4aeeb9449de4b9c1a.tar.gz rneovim-5bda5c5bf2e163657b3846a4aeeb9449de4b9c1a.tar.bz2 rneovim-5bda5c5bf2e163657b3846a4aeeb9449de4b9c1a.zip |
vim_getenv: Use v:progpath instead of os_exepath.
-rw-r--r-- | src/nvim/os/env.c | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/src/nvim/os/env.c b/src/nvim/os/env.c index 8f7a6e72b5..3c8f61a39e 100644 --- a/src/nvim/os/env.c +++ b/src/nvim/os/env.c @@ -634,18 +634,17 @@ char *vim_getenv(const char *name) char exe_name[MAXPATHL]; // Find runtime path relative to the nvim binary: ../share/nvim/runtime if (vim_path == NULL) { - size_t exe_name_len = MAXPATHL; - if (os_exepath(exe_name, &exe_name_len) == 0) { - char *path_end = (char *)path_tail_with_sep((char_u *)exe_name); - *path_end = '\0'; // remove the trailing "nvim.exe" - path_end = (char *)path_tail((char_u *)exe_name); - *path_end = '\0'; // remove the trailing "bin/" - if (append_path( - exe_name, - "share" _PATHSEPSTR "nvim" _PATHSEPSTR "runtime" _PATHSEPSTR, - MAXPATHL) == OK) { - vim_path = exe_name; // -V507 - } + xstrlcpy(exe_name, (char *)get_vim_var_str(VV_PROGPATH), + sizeof(exe_name)); + char *path_end = (char *)path_tail_with_sep((char_u *)exe_name); + *path_end = '\0'; // remove the trailing "nvim.exe" + path_end = (char *)path_tail((char_u *)exe_name); + *path_end = '\0'; // remove the trailing "bin/" + if (append_path( + exe_name, + "share" _PATHSEPSTR "nvim" _PATHSEPSTR "runtime" _PATHSEPSTR, + MAXPATHL) == OK) { + vim_path = exe_name; // -V507 } } |