Prevent backslashes from being used in command names

develop
lethosor 2015-02-27 18:46:29 -05:00
parent 45acf61b17
commit 0c09feae5b
1 changed files with 12 additions and 0 deletions

@ -460,6 +460,18 @@ command_result Core::runCommand(color_ostream &con, const std::string &first, ve
{
if (!first.empty())
{
// Disallow backslashes in commands (e.g. script names), for consistency
if(first.find('\\') != std::string::npos)
{
std::string suggestion = first;
for (size_t i = 0; i < suggestion.size(); i++)
{
if (suggestion[i] == '\\')
suggestion[i] = '/';
}
con.printerr("Backslashes in command names are not valid. Use %s instead.\n", suggestion.c_str());
return CR_NOT_IMPLEMENTED;
}
// let's see what we actually got
if(first=="help" || first == "?" || first == "man")
{