Skip to content

Commit

Permalink
Merge pull request #256 from TheCjw/master
Browse files Browse the repository at this point in the history
Add single mode support.
  • Loading branch information
MartiUK committed Nov 6, 2014
2 parents 373e1ef + 18fea0a commit 1883054
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions launcher/src/CmderLauncher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ optpair GetOption()
return pair;
}

void StartCmder(std::wstring path)
void StartCmder(std::wstring path, bool is_single_mode)
{
#if USE_TASKBAR_API
wchar_t appId[MAX_PATH] = { 0 };
Expand All @@ -102,7 +102,14 @@ void StartCmder(std::wstring path)
PathCombine(cfgPath, exeDir, L"config\\ConEmu.xml");
PathCombine(conEmuPath, exeDir, L"vendor\\conemu-maximus5\\ConEmu.exe");

swprintf_s(args, L"/Icon \"%s\" /Title Cmder /LoadCfgFile \"%s\"", icoPath, cfgPath);
if (is_single_mode)
{
swprintf_s(args, L"/single /Icon \"%s\" /Title Cmder /LoadCfgFile \"%s\"", icoPath, cfgPath);
}
else
{
swprintf_s(args, L"/Icon \"%s\" /Title Cmder /LoadCfgFile \"%s\"", icoPath, cfgPath);
}

SetEnvironmentVariable(L"CMDER_ROOT", exeDir);
SetEnvironmentVariable(L"CMDER_START", path.c_str());
Expand Down Expand Up @@ -229,7 +236,11 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance,

if (streqi(opt.first.c_str(), L"/START"))
{
StartCmder(opt.second);
StartCmder(opt.second, false);
}
else if (streqi(opt.first.c_str(), L"/SINGLE"))
{
StartCmder(opt.second, true);
}
else if (streqi(opt.first.c_str(), L"/REGISTER"))
{
Expand All @@ -243,7 +254,7 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance,
}
else
{
MessageBox(NULL, L"Unrecognized parameter.\n\nValid options:\n /START <path>\n /REGISTER [USER/ALL]\n /UNREGISTER [USER/ALL]", MB_TITLE, MB_OK);
MessageBox(NULL, L"Unrecognized parameter.\n\nValid options:\n /START <path>\n /SINGLE <path>\n /REGISTER [USER/ALL]\n /UNREGISTER [USER/ALL]", MB_TITLE, MB_OK);
return 1;
}

Expand Down

0 comments on commit 1883054

Please # to comment.