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

fixed root path error for windows #935

Merged
merged 2 commits into from Feb 1, 2019
Merged

Conversation

zcodes
Copy link
Contributor

@zcodes zcodes commented Jan 18, 2019

there are two problems when change cwd to windows disk root like 'd:\'

  1. if set 'noshellslash', nerdtree can open, but will crash when open sub directory of 'd:\', such as 'd:\docs'
  2. if set 'shellslash', nerdtree can be opened, and error message will echo NERDTree: No bookmark or dirctory found for:

the core point of these problems is that the function getcwd() result diffrent style for 'd:\' and 'd:\docs',
if set 'noshellslash', getcwd() return 'd:\' with trailing slash and 'd:\docs' without trailing slash.
if set 'shellslash', getcwd() return 'd:/' and 'd:/docs', the function s:Path.AbsolutePathFor() does not handle
these differences properly.

this pr maybe related to #860 #890 #895

@PhilRunninger
Copy link
Member

@zcodes, Thanks for the contribution. I have no way to verify the proposed changes for about a week. In the meantime, I have some comments on a couple lines of code.

@PhilRunninger
Copy link
Member

Dang! FastHub (my phone app for GitHub) won't let me make comments on specific lines, so... Will line 28 work if you use s:Path.Slash() and eliminate the OR condition? If so, I think you don't even need the runningWindows() check anymore.

@PhilRunninger
Copy link
Member

I believe the change to line 18 is not needed. That line is checking for the presence of one of the following: C:\, C:/, \\, or // at the beginning of the line.

@zcodes
Copy link
Contributor Author

zcodes commented Jan 20, 2019

for the line 28, I simplify the code.

for line 18, the change is needed, some condition, the args (the path string) passed to the function is just 'd:', not 'd:\' or 'd:/', the result string will be 'd:d:/', that's why #860

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

2 participants