mirror of
https://github.com/cmderdev/cmder.git
synced 2026-06-17 07:11:05 +08:00
Normalize ConEmu task names
This commit is contained in:
@@ -105,6 +105,18 @@ bool FileExists(const wchar_t * filePath)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::wstring NormalizeTaskName(std::wstring taskName)
|
||||||
|
{
|
||||||
|
// ConEmu task labels are commonly passed as "{task}" on the command line.
|
||||||
|
// Strip the outer braces so we do not add a second pair later when building /run.
|
||||||
|
if (taskName.length() > 1 && taskName.front() == L'{' && taskName.back() == L'}')
|
||||||
|
{
|
||||||
|
return taskName.substr(1, taskName.length() - 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
return taskName;
|
||||||
|
}
|
||||||
|
|
||||||
void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstring taskName = L"", std::wstring title = L"", std::wstring iconPath = L"", std::wstring cfgRoot = L"", bool use_user_cfg = true, std::wstring conemu_args = L"")
|
void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstring taskName = L"", std::wstring title = L"", std::wstring iconPath = L"", std::wstring cfgRoot = L"", bool use_user_cfg = true, std::wstring conemu_args = L"")
|
||||||
{
|
{
|
||||||
#if USE_TASKBAR_API
|
#if USE_TASKBAR_API
|
||||||
@@ -132,6 +144,7 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr
|
|||||||
|
|
||||||
std::wstring cmderStart = path;
|
std::wstring cmderStart = path;
|
||||||
std::wstring cmderTask = taskName;
|
std::wstring cmderTask = taskName;
|
||||||
|
cmderTask = NormalizeTaskName(cmderTask);
|
||||||
std::wstring cmderTitle = title;
|
std::wstring cmderTitle = title;
|
||||||
std::wstring cmderConEmuArgs = conemu_args;
|
std::wstring cmderConEmuArgs = conemu_args;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user