-
Notifications
You must be signed in to change notification settings - Fork 17.8k
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
os: Open("/") fails on Windows #35492
Comments
Is this a new thing, or forward slashes were always supported in Windows ? |
Back- and forward-slashes have long been interchangeable on Windows. cc @alexbrainman @mattn @zx2c4 |
@apmckinlay yes both / and \ should work in this situation. Would you like to send a fix for this? This https://golang.org/doc/contribute.html is how to contribute. Thank you. Alex |
Sure, first time, but I’ll read the instructions.
…On Tue, Nov 12, 2019 at 02:38 Alex Brainman ***@***.***> wrote:
@apmckinlay <https://github.com/apmckinlay> yes both / and \ should work
in this situation.
Would you like to send a fix for this? This
https://golang.org/doc/contribute.html is how to contribute.
Thank you.
Alex
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#35492?email_source=notifications&email_token=AAPRDXVGKOFGZO72ULLDON3QTJTQRA5CNFSM4JLNV22KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEDZOPMY#issuecomment-552789939>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAPRDXSUPSQBRG644NGMBXTQTJTQRANCNFSM4JLNV22A>
.
|
You could post to golang-dev asking if anyone would like to implement this; that's probably the quickest path to a patch... |
Ah, I did not read this thread. I already have my changes to fix this on my local PC. @apmckinlay do you try this soon? (please feel free to answer). |
@mattn If you have a fix already prepared that's great, go ahead. (I am travelling so I would be slow) |
Change https://golang.org/cl/206997 mentions this issue: |
What version of Go are you using (
go version
)?What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
What did you expect to see?
I expected it to succeed, i.e. err == nil
What did you see instead?
It failed with:
It works (err == nil) if you use a backslash:
file_windows.go openDir has:
Since it only checks for trailing back slash, for forward slash "/" it adds
\*
resulting in/\*
which is invalid.Obviously, the workaround is to use back slash instead of forward slash. But since forward slashes work in file paths in many/most other places, it might be worth checking for either slash in openDir.
The text was updated successfully, but these errors were encountered: