diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2017-01-11 06:00:55 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-01-11 06:00:55 +0100 |
commit | 207ba359b0127fa5893b980abcb9186ffec1879c (patch) | |
tree | e055ede440eb3e06f2f9ba8db00f0ab16416369c /src/nvim/os/fs.c | |
parent | a08d2f54a0bd8cb9b6a4072a6adcc7eeee4690c2 (diff) | |
download | rneovim-207ba359b0127fa5893b980abcb9186ffec1879c.tar.gz rneovim-207ba359b0127fa5893b980abcb9186ffec1879c.tar.bz2 rneovim-207ba359b0127fa5893b980abcb9186ffec1879c.zip |
Windows: vim_getenv(): Find runtime relative to nvim. #3303 (#5929)
In Windows we cannot rely on absolute install paths to point to the
location of the runtime. Vim uses the path of the current binary as
a possible location for the runtime folder. In Neovim the install
location places the runtime folder in ../share/nvim/runtime.
In Vim this logic is guarded by USE_EXE_NAME, which is defined for win32
and macOS.
TODO: We may need to incorporate similar logic for macOS:
https://github.com/vim/vim/blob/0cdb72aa38c4a0140c94d56bf8bc17cb30260ebf/src/misc1.c#L4287-L4308
Diffstat (limited to 'src/nvim/os/fs.c')
-rw-r--r-- | src/nvim/os/fs.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/nvim/os/fs.c b/src/nvim/os/fs.c index 3c821936e9..4aa727733e 100644 --- a/src/nvim/os/fs.c +++ b/src/nvim/os/fs.c @@ -192,6 +192,18 @@ int os_nodetype(const char *name) return nodetype; } +/// Gets the absolute path of the currently running executable. +/// +/// @param[out] buffer Returns the path string. +/// @param[in] size Size of `buffer`. +/// +/// @return `0` on success, or libuv error code on failure. +int os_exepath(char *buffer, size_t *size) + FUNC_ATTR_NONNULL_ALL +{ + return uv_exepath(buffer, size); +} + /// Checks if the given path represents an executable file. /// /// @param[in] name Name of the executable. |