Skip to content
New issue

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

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

Already on GitHub? # to your account

fix(#2862): windows path replaces backslashes with forward slashes #2903

Merged
merged 5 commits into from
Sep 15, 2024

Conversation

dogeggz
Copy link
Contributor

@dogeggz dogeggz commented Sep 11, 2024

Fix #2862

Changes:

  • Replaces \ with / in file paths for Windows.
  • Applies the updated path handling to functions that use the filename (e.g. open, open in tab, split, etc.).

Note:

  • Verified that all filename-related tasks work fine on my Windows machine.
  • Not sure if this change will affect anything else though.

Copy link
Member

@alex-courtis alex-courtis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Many thanks for your contribution, this looks reasonable.

It looks like all changes are hidden behind the appropriate OS feature flag, thank you.

nvim-tree developers don't have access to or expertise with windows, hence can't test this.

Please be prepared to quickly resolve any issues that may arise from this change. nvim-tree developers will have no option but to roll it back.

@alex-courtis alex-courtis changed the title Fix Windows path issue by replacing backslashes with forward slashes fix(#2862): windows path replaces backslashes with forward slashes Sep 14, 2024
Copy link
Member

@alex-courtis alex-courtis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This slash change is quite far-reaching and may result in difficulties for various configurations.

Please verify this change on the variants of windows:

  • WSL
  • powershell
  • nvim-qt

Cygwin / msys2 would be great, however I believe their setup is difficult and there are few users, so I'm happy to take a risk.

@dogeggz dogeggz closed this Sep 15, 2024
@dogeggz
Copy link
Contributor Author

dogeggz commented Sep 15, 2024

I verified the file-opening tasks on all three variants, and everything works fine on my end。

@dogeggz dogeggz reopened this Sep 15, 2024
@alex-courtis
Copy link
Member

Many thanks for your contribution @dogeggz

@alex-courtis alex-courtis merged commit 45a93d9 into nvim-tree:master Sep 15, 2024
5 checks passed
@dogeggz dogeggz deleted the fix-windows-path branch September 15, 2024 02:24
alex-courtis added a commit that referenced this pull request Oct 25, 2024
#2962)

* Revert "fix(#2862): windows path replaces backslashes with forward slashes (#2903)"

This reverts commit 45a93d9.

* fix the case when '()' and '[]' are both in file path

* remove debug messages

* remove unnecessary comments

* add is_windows feature flag when normalizing path

* add is_windows flag for filename change

* Revert "add is_windows flag for filename change"

This reverts commit ada77cb.

---------

Co-authored-by: Alexander Courtis <alex@courtis.org>
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Wrong filepath opened when selecting file
2 participants