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

Tiny tweaks and fixes for the PowerShell provisioner #11410

Merged
merged 15 commits into from
Nov 23, 2021
Merged

Tiny tweaks and fixes for the PowerShell provisioner #11410

merged 15 commits into from
Nov 23, 2021

Conversation

azr
Copy link
Contributor

@azr azr commented Nov 22, 2021

  • make sure we're consistently documenting slashes
  • fix a potential bug

fix #6188

@azr azr requested a review from a team as a code owner November 22, 2021 14:24
Comment on lines +289 to +291
if os.IsPathSeparator(p.config.RemotePath[len(p.config.RemotePath)-1]) {
// path is a directory
p.config.RemotePath += filepath.Base((fi).Name())
p.config.RemotePath += filepath.Base(fi.Name())
Copy link
Contributor Author

Choose a reason for hiding this comment

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

os.IsPathSeparator on Windows will check for \ and / ! filepath.Base internally uses IsPathSeparator to find the base path, so it should be fine.

Copy link
Member

Choose a reason for hiding this comment

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

Nice 👍 - thanks for the call out here.

Copy link
Member

@nywilken nywilken left a comment

Choose a reason for hiding this comment

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

Overall this looks like a much needed change. There are two small updates needed for the documentation to wrap up the change. See comments inline.

Approving in advance to unblock the merge.

Comment on lines +289 to +291
if os.IsPathSeparator(p.config.RemotePath[len(p.config.RemotePath)-1]) {
// path is a directory
p.config.RemotePath += filepath.Base((fi).Name())
p.config.RemotePath += filepath.Base(fi.Name())
Copy link
Member

Choose a reason for hiding this comment

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

Nice 👍 - thanks for the call out here.

Comment on lines 19 to 21
~> On Windows, if possible, try to always use a backslash `\` as a path
separator, especially when dealing with non full paths. This is because when

Copy link
Member

Choose a reason for hiding this comment

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

The examples below use / and not \ should this suggestion be updated?

I think this rationale will be helpful "This is because when..."

Suggested change
~> On Windows, if possible, try to always use a backslash `\` as a path
separator, especially when dealing with non full paths. This is because when
~> On Windows, if possible, try to always use a backslash `\` as the path
separator, especially when dealing with relative paths. The use of backslashes helps with [....]

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ha yes, good catch, this is a WIP commit I pushed before we switched over to the acc tests branch ! Fixing now.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I made it clearer; and now wonder if we should display this in other places too. Ah, I will make a template out of this !

@github-actions
Copy link

I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 24, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

filepath.[Dir|Base|ToSlash] behave differently depending on platform and path format
2 participants