aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/os/env.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/nvim/os/env.c')
-rw-r--r--src/nvim/os/env.c14
1 files changed, 3 insertions, 11 deletions
diff --git a/src/nvim/os/env.c b/src/nvim/os/env.c
index fbc3a243a6..5a79004c41 100644
--- a/src/nvim/os/env.c
+++ b/src/nvim/os/env.c
@@ -474,17 +474,9 @@ void init_homedir(void)
var = os_homedir();
}
- if (var != NULL) {
- // Change to the directory and get the actual path. This resolves
- // links. Don't do it when we can't return.
- if (os_dirname(os_buf, MAXPATHL) == OK && os_chdir(os_buf) == 0) {
- if (!os_chdir(var) && os_dirname(IObuff, IOSIZE) == OK) {
- var = IObuff;
- }
- if (os_chdir(os_buf) != 0) {
- emsg(_(e_prev_dir));
- }
- }
+ // Get the actual path. This resolves links.
+ if (var != NULL && os_realpath(var, IObuff, IOSIZE) != NULL) {
+ var = IObuff;
}
// Fall back to current working directory if home is not found