Skip to content
Permalink
Browse files

Add stripIgnoredParams to implement "Wish: "ignore first item" comman…

…d line argument (for replacing Notepad)"

Closes #852
  • Loading branch information...
CookiePLMonster committed Jul 2, 2018
1 parent 74d39b1 commit f0821d983593a0d3e1afcf5f61b1937c4f16be50
Showing with 22 additions and 0 deletions.
  1. +22 −0 PowerEditor/src/winmain.cpp
@@ -90,6 +90,27 @@ ParamVector parseCommandLine(const TCHAR* commandLine)
return result;
}

// Looks for -z arguments and strips command line arguments following those, if any
void stripIgnoredParams(ParamVector & params)
{
for ( auto it = params.begin(); it != params.end(); )
{
if (lstrcmp(it->c_str(), TEXT("-z")) == 0)
{
auto nextIt = std::next(it);
if ( nextIt != params.end() )
{
params.erase(nextIt);
}
it = params.erase(it);
}
else
{
++it;
}
}
}

bool isInList(const TCHAR *token2Find, ParamVector& params, bool eraseArg = true)
{
for (auto it = params.begin(); it != params.end(); ++it)
@@ -258,6 +279,7 @@ void doException(Notepad_plus_Window & notepad_plus_plus)
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR, int)
{
ParamVector params = parseCommandLine(::GetCommandLine());
stripIgnoredParams(params);

MiniDumper mdump; //for debugging purposes.

0 comments on commit f0821d9

Please sign in to comment.
You can’t perform that action at this time.