dont use the whole commandline as a fall back for execution searching because it could contain spaces. also, wrap commandline params in quotes so if there is a space in the path it still finds it. bug found by billgMS.

svn path=/trunk/; revision=18250
This commit is contained in:
Brandon Turner 2005-10-03 20:28:29 +00:00
parent 7402ea80eb
commit ce7daa3fef

View file

@ -422,8 +422,6 @@ Execute (LPTSTR Full, LPTSTR First, LPTSTR Rest)
/* get the PATH environment variable and parse it */ /* get the PATH environment variable and parse it */
/* search the PATH environment variable for the binary */ /* search the PATH environment variable for the binary */
if (!SearchForExecutable (first, szFullName)) if (!SearchForExecutable (first, szFullName))
{
if (!SearchForExecutable (full, szFullName))
{ {
error_bad_command (); error_bad_command ();
free (first); free (first);
@ -431,7 +429,6 @@ Execute (LPTSTR Full, LPTSTR First, LPTSTR Rest)
free (full); free (full);
free (szFullName); free (szFullName);
return; return;
}
} }
@ -1619,13 +1616,14 @@ Initialize (int argc, TCHAR* argv[])
++i; ++i;
if (i < argc) if (i < argc)
{ {
_tcscpy (commandline, argv[i]); _tcscpy (commandline, _T("\""));
_tcscat (commandline, argv[i]);
_tcscat (commandline, _T("\""));
while (++i < argc) while (++i < argc)
{ {
_tcscat (commandline, _T(" ")); _tcscat (commandline, _T(" "));
_tcscat (commandline, argv[i]); _tcscat (commandline, argv[i]);
} }
ParseCommandLine(commandline); ParseCommandLine(commandline);
} }
} }