Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: absolute paths should not use the guest cwd #34

Merged
merged 1 commit into from
Apr 8, 2023

Conversation

davidmh
Copy link
Contributor

@davidmh davidmh commented Apr 8, 2023

This is a follow-up to #30.

Removing the vim.loop.fs_realpath check helps with relative paths that exist in the guest, but it breaks absolute paths.

For example, in a neovim terminal

cd /tmp/
vim /tmp/a/file.txt

Would concatenate the path to /tmp//tmp/a/file.txt

I'm guessing checking for the real path was supposed to handle that scenario, it just conflicted with relative paths that matched the host cwd.

This commit checks each file to see if it's absolute and avoid prepending the guest cwd.

@davidmh davidmh force-pushed the fix-absolute-paths branch from e828afc to 9e8a89a Compare April 8, 2023 21:17
This is a follow-up to willothy#30.

Removing the `vim.loop.fs_realpath` check helps with relative paths that
exist in the guest, but it breaks absolute paths.

For example, in a neovim terminal

```shell
cd /tmp/
vim /tmp/a/file.txt
```

Would concatenate the path to `/tmp//tmp/a/file.

I'm guessing checking for the real path was supposed to handle that
scenario, it just conflicted with relative paths that matched the host
cwd.

This commit checks each file to see if it's absolute and avoid
prepending the guest cwd.
@davidmh davidmh force-pushed the fix-absolute-paths branch from 9e8a89a to 27d3582 Compare April 8, 2023 21:28
@willothy willothy merged commit bac6a6a into willothy:main Apr 8, 2023
@willothy
Copy link
Owner

willothy commented Apr 8, 2023

Tested, fix works 👍

@davidmh davidmh deleted the fix-absolute-paths branch April 8, 2023 21:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants