-
Notifications
You must be signed in to change notification settings - Fork 8.2k
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
Improve startingDirectory
functionality
#604
Conversation
This commit adds the `startingDirectory` property to the default-created `cmd` and `powershell` profiles, with the default value `%HOMEDRIVE%%HOMEPATH%`. Signed-off-by: Fred Miller <fghzxm@outlook.com>
@DHowett-MSFT I inspected the lnks to cmd.exe and powershell.exe in my Start Menu, and they all have |
@@ -123,6 +122,7 @@ void CascadiaSettings::_CreateDefaultProfiles() | |||
Profile defaultProfile{}; | |||
defaultProfile.SetFontFace(L"Consolas"); | |||
defaultProfile.SetCommandline(L"cmd.exe"); | |||
defaultProfile.SetStartingDirectory(L"%HOMEDRIVE%%HOMEPATH%"); |
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.
HOMEDRIVE and HOMEPATH may not be set in all scenarios. If you look at powershell core it has to deal with this today. So unless an empty result here is valid, this logic probably needs to be centralized.
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.
See notes here:
https://stackoverflow.com/posts/36392591/revisions
But as far as I can tell, that default isn't set in Powershell code, it's set in the shortcut. Should the same be true of Terminal? Should the shortcut created by the deployment point there? Can a UWP app do that? |
This commit changes `%USERPROFILE%` in the default profiles to `%HOMEDRIVE%%HOMEPATH%`. https://stackoverflow.com/posts/36392591/revisions says `%USERPROFILE%` is better than `%HOMEDRIVE%%HOMEPATH%`, so changed it. Signed-off-by: Fred Miller <fghzxm@outlook.com>
BTW, should we use |
Ah, almost certainly. I'm on the fence about |
@DHowett-MSFT Wait, I don't think PowerShell Core is shipped with Windows. |
@fghzxm we actually have some code in the terminal already that attempts to detect if powershell core is installed, and uses |
This commit adds the `startingDirectory` property to the default-created `cmd` and `powershell` profiles, with the default value `%HOMEDRIVE%%HOMEPATH%`. Signed-off-by: Fred Miller <fghzxm@outlook.com>
This commit changes `%USERPROFILE%` in the default profiles to `%HOMEDRIVE%%HOMEPATH%`. https://stackoverflow.com/posts/36392591/revisions says `%USERPROFILE%` is better than `%HOMEDRIVE%%HOMEPATH%`, so changed it. Signed-off-by: Fred Miller <fghzxm@outlook.com>
Signed-off-by: Fred Miller <fghzxm@outlook.com>
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.
This is great, thanks @fghzxm.
We'll probably not merge until Monday once we're all back in the office from the weekend. 😄
Refer to the externally defined constant in code. Signed-off-by: Fred Miller <fghzxm@outlook.com>
This commit adds the
startingDirectory
property to the default-createdcmd
andpowershell
profiles, with the default value%HOMEDRIVE%%HOMEPATH%
.Signed-off-by: Fred Miller fghzxm@outlook.com