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

Fix how we reference Special folders (Desktop, Documents) #77

Merged
merged 1 commit into from
Nov 10, 2017

Conversation

HowardWolosky
Copy link
Member

@HowardWolosky HowardWolosky commented Nov 10, 2017

We previously referenced the Desktop and Documents folders like so:
$home\Documents and $home\desktop, but those folders can be
redirected to a different drive (and folder name) without changing
the user�'s profile directory (e.g. $home).

Given this, we will use the special method
[System.Environment]::GetFolderPath()
which can give us the correct path to those "special folders"
(named MyDocuments and Desktop).

This required minor changes to the code and the documentation.

$output = @()
$output += "The config file used to generate this submission did not have an AppId defined in it."
$output += "The AppId entry in the config helps ensure that payloads are not submitted to the wrong application."
$output += "Please update your app's StoreBroker config file by adding an ""appId"" property with"
$output += "your app's AppId to the ""appSubmission"" section. If you're unclear on what change"
$output += "needs to be done, you can re-generate your config file using"
$output += " ""New-StoreBrokerConfigFile -AppId $AppId"" -Path ""`$home\desktop\newconfig.json"""
$output += " ""New-StoreBrokerConfigFile -AppId $AppId -Path ""$configPath"""
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: I prefer the back-tick + double quote syntax over 2x double quote because it takes away the need to mentally parse the string.

Copy link
Member Author

Choose a reason for hiding this comment

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

Fair feedback. Will fix.

{
$global:SBLogPath = $(Join-Path $env:USERPROFILE "Documents\StoreBroker.log")
$global:SBLogPath = (Join-Path -Path $documentsFolder -ChildPath 'StoreBroker.log')
Copy link
Contributor

Choose a reason for hiding this comment

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

In this CR, when we're assigning the result of Join-Path to a variable, we're inconsistent about whether the expression is wrapped in parens or not.

Copy link
Member Author

Choose a reason for hiding this comment

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

Ah, good catch. There's no need for that outer parenthesis...I'll remove it.

We previously referenced the Desktop and Documents folders like so:
`$home\Documents` and `$home\desktop`, but those folders can be
redirected to a different drive (and folder name) without changing
the user�s profile directory (e.g. `$home`).

Given this, we will use the special method
[[System.Environment]::GetFolderPath()](https://msdn.microsoft.com/en-us/library/14tx8hby%28v=vs.110%29.aspx)
which can give us the correct path to those ["special folders"](https://msdn.microsoft.com/en-us/library/system.environment.specialfolder(v=vs.110).aspx)
(named `MyDocuments` and `Desktop`).

This required minor changes to the code and the documentation.
@HowardWolosky HowardWolosky merged commit 3750894 into microsoft:master Nov 10, 2017
@HowardWolosky HowardWolosky deleted the documentsFix branch November 10, 2017 21:35
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.

2 participants