-
Notifications
You must be signed in to change notification settings - Fork 275
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 some path logic to work on Windows #2704
Merged
Merged
Changes from 10 commits
Commits
Show all changes
29 commits
Select commit
Hold shift + click to select a range
c18b611
Fix some path logic to work on Windows
jchadwick-buf 85f9e39
Set a FSRoot in filepathext package
doriable 4d88b2a
Run `make generate`
doriable a106cf0
Small fixes to test
doriable 1f88005
Some more fixes
doriable b5c666e
Merge remote-tracking branch 'origin/bufmod' into jchadwick/bufmod-wi…
doriable ffdf1ef
More reader_test assertion fixes
doriable 34ce447
Need to parse components in order to get relative input path
doriable c64f727
Fix absolute path tests for Windows workspaces
doriable 3df5d92
Attempt to use USERPROFILE to get volume of current process
doriable 6003241
Revert back to using normalpath.Components fix and add comments
doriable 3ac2242
Fix some low hanging fruit to unnormalize file paths in error returns
doriable 07041e7
Add filepath.Clean to decode/encode errors
doriable fd39088
A couple more clean-ups
doriable c93de2f
More fixes
doriable fa317be
More simple fixes
doriable 0caa8ed
Add TODOs for archive test failures
doriable 7334382
Change exclude path error
doriable 51e85b3
Merge remote-tracking branch 'origin/bufmod' into jchadwick/bufmod-wi…
doriable ebe2579
Add skips for formatter and bufimageutil/generate tests
doriable ea950f7
Add skips for storagetesting package for carriage returns
doriable 37740e7
Add more TODOs
doriable 1fe3539
Merge remote-tracking branch 'origin/bufmod' into jchadwick/bufmod-wi…
doriable 2bc8859
Change the .gitattributes to `-text -diff` for testdata files
doriable 8ecf668
Ungate bufimageutil tests
doriable 66a0f04
Ungate generate test
doriable bb6c42f
Merge remote-tracking branch 'origin/bufmod' into jchadwick/bufmod-wi…
doriable c5b8cb9
Use t.TempDir() for archive tests for unique temp directories for tes…
doriable d8924ce
Skip invalid path archive tests
doriable File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// Copyright 2020-2023 Buf Technologies, Inc. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
//go:build aix || darwin || dragonfly || freebsd || (js && wasm) || linux || netbsd || openbsd || solaris | ||
// +build aix darwin dragonfly freebsd js,wasm linux netbsd openbsd solaris | ||
|
||
package filepathext | ||
|
||
import ( | ||
"os" | ||
) | ||
|
||
var ( | ||
FSRoot = string(os.PathSeparator) | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// Copyright 2020-2023 Buf Technologies, Inc. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
//go:build windows | ||
// +build windows | ||
|
||
package filepathext | ||
|
||
import ( | ||
"os" | ||
"path/filepath" | ||
) | ||
|
||
var ( | ||
// USERPROFILE shows the current user's profile folder. It is being used to parse the volume | ||
// for the current user and this is used as the process's context. | ||
// https://learn.microsoft.com/en-us/windows/deployment/usmt/usmt-recognized-environment-variables#variables-that-are-processed-for-the-operating-system-and-in-the-context-of-each-user | ||
FSRoot = filepath.VolumeName(os.Getenv("USERPROFILE")) + string(os.PathSeparator) | ||
) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I retract my comment earlier, I think it isn't feasible to parse this through the system env vars -- the process could just be running in an entirely separate drive, which is what is happening in the actions. We should use
normalpath.Components
when parsing the absolute paths and document clearly the behaviours of howreader.go
is constructing the OS root buckets.