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

Winpathfix #591

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Winpathfix #591

wants to merge 2 commits into from

Conversation

CheeseTurtle
Copy link

The misguided assumption that the path separator on Windows would always be a backslash, and therefore that checking if the path separator was a backslash was equivalent to checking if the OS was Windows, there were issues with path normalization when using forward slash as the path separator on Windows (with the 'shellslash' option set).

My tweaks involve checking for the existence of the 'shellslash' option to determine whether or not to use Windows-style paths, and (if it does exist) checking its value to determine which path separator to expect. I also added the invocation of the vim.fs.normalize function at the end of the Plenary path normalization function to hopefully catch any edge cases, although in hindsight it's probably best to only invoke it when there are still both forward and backward slashes in the path at that point.

Added support for Windows-style paths with forward slash (i.e. when `vim.fn.exists('+shellslash')` and `vim.opt.shellslash._value` are both `true`). Previously the code assumed that sep would be '/' iff the OS was not Windows. I have reworked the code to avoid this assumption.

I also added an additional call to the built-in path normalizer at the end of the Plenary normalization function, just in case.
Replaced path.sep with regex class of forward and backwards slash for path checking of absolute/root on Windows
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.

None yet

1 participant