aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/os
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2024-08-09 07:45:21 +0800
committerGitHub <noreply@github.com>2024-08-09 07:45:21 +0800
commitb9913191be0b4884d92db794e2eb92641523a415 (patch)
tree1b2733ebccb2339ee5e5df27658a9adf44f9c43e /src/nvim/os
parenta89088b7a02b70d15ccd6f17402c36f2ff7b7a81 (diff)
parente01ccda1bebf2d420d725478b480740ff45ad6ad (diff)
downloadrneovim-b9913191be0b4884d92db794e2eb92641523a415.tar.gz
rneovim-b9913191be0b4884d92db794e2eb92641523a415.tar.bz2
rneovim-b9913191be0b4884d92db794e2eb92641523a415.zip
Merge pull request #30015 from zeertzjq/vim-8.2.4860
vim-patch: Check NoDefaultCurrentDirectoryInExePath
Diffstat (limited to 'src/nvim/os')
-rw-r--r--src/nvim/os/fs.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/nvim/os/fs.c b/src/nvim/os/fs.c
index b681b2f832..d0da37b8e7 100644
--- a/src/nvim/os/fs.c
+++ b/src/nvim/os/fs.c
@@ -17,7 +17,6 @@
#endif
#include "auto/config.h"
-#include "nvim/errors.h"
#include "nvim/os/fs.h"
#include "nvim/os/os_defs.h"
@@ -36,6 +35,7 @@
#include "nvim/api/private/helpers.h"
#include "nvim/ascii_defs.h"
+#include "nvim/errors.h"
#include "nvim/gettext_defs.h"
#include "nvim/globals.h"
#include "nvim/log.h"
@@ -356,10 +356,16 @@ static bool is_executable_in_path(const char *name, char **abspath)
}
#ifdef MSWIN
- // Prepend ".;" to $PATH.
- size_t pathlen = strlen(path_env);
- char *path = memcpy(xmallocz(pathlen + 2), "." ENV_SEPSTR, 2);
- memcpy(path + 2, path_env, pathlen);
+ char *path = NULL;
+ if (!os_env_exists("NoDefaultCurrentDirectoryInExePath")) {
+ // Prepend ".;" to $PATH.
+ size_t pathlen = strlen(path_env);
+ path = xmallocz(pathlen + 2);
+ memcpy(path, "." ENV_SEPSTR, 2);
+ memcpy(path + 2, path_env, pathlen);
+ } else {
+ path = xstrdup(path_env);
+ }
#else
char *path = xstrdup(path_env);
#endif