Skip to content

Commit

Permalink
Use Profile for Windows Terminal
Browse files Browse the repository at this point in the history
  • Loading branch information
yuk7 committed Mar 24, 2020
1 parent 4881d68 commit c1f0d92
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
6 changes: 3 additions & 3 deletions main.c
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,9 @@ int main()
{
if (wslInstallation.termInfo == 1) //Windows Terminal
{
wchar_t Ecmd[200] = L"wt.exe \"";
wcscat_s(Ecmd, ARRAY_LENGTH(Ecmd), efpath);
wcscat_s(Ecmd, ARRAY_LENGTH(Ecmd), L"\" run");
wchar_t Ecmd[200] = L"wt.exe -p \"";
wcscat_s(Ecmd, ARRAY_LENGTH(Ecmd), wslInstallation.distroName);
wcscat_s(Ecmd, ARRAY_LENGTH(Ecmd), L"\" -d .");

FreeConsole();
STARTUPINFOW si = {0};
Expand Down
5 changes: 4 additions & 1 deletion wsld.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ WSLLAUNCH WslLaunch;
struct WslInstallation {
wchar_t uuid[UUID_SIZE+1];
wchar_t basePath[MAX_BASEPATH_SIZE];
wchar_t distroName[MAX_DISTRO_NAME_SIZE];
long termInfo;
} WslInstallation;

Expand Down Expand Up @@ -93,7 +94,7 @@ return 0;
}

struct WslInstallation WslGetInstallationInfo(wchar_t *DistributionName) {
struct WslInstallation wslInstallation = {.uuid = {0}, .basePath = {0}, .termInfo = 0};
struct WslInstallation wslInstallation = {.uuid = {0}, .basePath = {0}, .distroName = {0}, .termInfo = 0};

HKEY hKey;
LONG rres;
Expand Down Expand Up @@ -134,6 +135,8 @@ struct WslInstallation WslGetInstallationInfo(wchar_t *DistributionName) {
{
// SUCCESS: Distribution found
wcscpy_s(wslInstallation.uuid, UUID_SIZE*2, subKey);
DWORD dnSize = MAX_DISTRO_NAME_SIZE*2;
RegQueryValueExW(hKeyS, L"DistributionName", NULL, &dwType, (LPBYTE)&wslInstallation.distroName, &dnSize);
DWORD pathSize = MAX_BASEPATH_SIZE*2;
rres = RegQueryValueExW(hKeyS, L"BasePath", NULL, &dwType, (LPBYTE)&wslInstallation.basePath, &pathSize);
if (rres != ERROR_SUCCESS)
Expand Down

0 comments on commit c1f0d92

Please sign in to comment.