Skip to content

Commit

Permalink
Improve startingDirectory functionality (#604)
Browse files Browse the repository at this point in the history
* Improve `startingDirectory` functionality

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>

* Use %USERPROFILE% to replace %HOMEDRIVE%%HOMEPATH%

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>

* Improve `startingDirectory` functionality

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>

* Use %USERPROFILE% to replace %HOMEDRIVE%%HOMEPATH%

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>

* Consolidate constant

Refer to the externally defined constant in code.

Signed-off-by: Fred Miller <fghzxm@outlook.com>
  • Loading branch information
fghzxm authored and DHowett committed May 11, 2019
1 parent bf460ab commit 6088134
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/cascadia/TerminalApp/CascadiaSettings.cpp
Expand Up @@ -6,6 +6,7 @@
#include <conattrs.hpp>
#include "CascadiaSettings.h"
#include "../../types/inc/utils.hpp"
#include "../../inc/DefaultSettings.h"

using namespace winrt::Microsoft::Terminal::Settings;
using namespace ::TerminalApp;
Expand Down Expand Up @@ -107,7 +108,6 @@ void CascadiaSettings::_CreateDefaultSchemes()
_globals.GetColorSchemes().emplace_back(_CreateCampbellScheme());
_globals.GetColorSchemes().emplace_back(_CreateSolarizedDarkScheme());
_globals.GetColorSchemes().emplace_back(_CreateSolarizedLightScheme());

}

// Method Description:
Expand All @@ -123,6 +123,7 @@ void CascadiaSettings::_CreateDefaultProfiles()
Profile cmdProfile{};
cmdProfile.SetFontFace(L"Consolas");
cmdProfile.SetCommandline(L"cmd.exe");
cmdProfile.SetStartingDirectory(DEFAULT_STARTING_DIRECTORY);
cmdProfile.SetColorScheme({ L"Campbell" });
cmdProfile.SetAcrylicOpacity(0.75);
cmdProfile.SetUseAcrylic(true);
Expand All @@ -143,14 +144,15 @@ void CascadiaSettings::_CreateDefaultProfiles()
}
powershellProfile.SetFontFace(L"Courier New");
powershellProfile.SetCommandline(psCmdline);
powershellProfile.SetStartingDirectory(DEFAULT_STARTING_DIRECTORY);
powershellProfile.SetColorScheme({ L"Campbell" });
powershellProfile.SetDefaultBackground(RGB(1, 36, 86));
powershellProfile.SetUseAcrylic(false);
powershellProfile.SetName(L"PowerShell");

_profiles.emplace_back(powershellProfile);
_profiles.emplace_back(cmdProfile);

_globals.SetDefaultProfile(powershellProfile.GetGuid());
}

Expand Down
5 changes: 5 additions & 0 deletions src/cascadia/TerminalApp/Profile.cpp
Expand Up @@ -427,6 +427,11 @@ void Profile::SetCommandline(std::wstring cmdline) noexcept
_commandline = cmdline;
}

void Profile::SetStartingDirectory(std::wstring startingDirectory) noexcept
{
_startingDirectory = startingDirectory;
}

void Profile::SetName(std::wstring name) noexcept
{
_name = name;
Expand Down
1 change: 1 addition & 0 deletions src/cascadia/TerminalApp/Profile.h
Expand Up @@ -40,6 +40,7 @@ class TerminalApp::Profile final
void SetColorScheme(std::optional<std::wstring> schemeName) noexcept;
void SetAcrylicOpacity(double opacity) noexcept;
void SetCommandline(std::wstring cmdline) noexcept;
void SetStartingDirectory(std::wstring startingDirectory) noexcept;
void SetName(std::wstring name) noexcept;
void SetUseAcrylic(bool useAcrylic) noexcept;
void SetDefaultForeground(COLORREF defaultForeground) noexcept;
Expand Down

0 comments on commit 6088134

Please sign in to comment.