Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 1050


Ignore:
Timestamp:
Apr 14, 2008, 1:27:51 AM (17 years ago)
Author:
landauf
Message:

bugfix

Location:
code/branches/core2/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • code/branches/core2/src/orxonox/core/CommandExecutor.cc

    r1049 r1050  
    415415                {
    416416                    if (tokens.size() >= 2)
    417                         return evaluation.shortcut_->parse(tokens.subSet(1).join() + evaluation.getAdditionalParameter());
     417                        return evaluation.shortcut_->parse(removeSlashes(tokens.subSet(1).join() + evaluation.getAdditionalParameter()));
    418418                    else
    419                         return evaluation.shortcut_->parse(evaluation.additionalParameter_);
     419                        return evaluation.shortcut_->parse(removeSlashes(evaluation.additionalParameter_));
    420420                }
    421421                break;
     
    429429                {
    430430                    if (tokens.size() >= 3)
    431                         return evaluation.function_->parse(tokens.subSet(2).join() + evaluation.getAdditionalParameter());
     431                        return evaluation.function_->parse(removeSlashes(tokens.subSet(2).join() + evaluation.getAdditionalParameter()));
    432432                    else
    433                         return evaluation.function_->parse(evaluation.additionalParameter_);
     433                        return evaluation.function_->parse(removeSlashes(evaluation.additionalParameter_));
    434434                }
    435435                break;
     
    447447                    {
    448448                        if (tokens.size() >= 4)
    449                             return evaluation.configvalue_->set(tokens.subSet(3).join() + evaluation.getAdditionalParameter());
     449                            return evaluation.configvalue_->set(removeSlashes(tokens.subSet(3).join() + evaluation.getAdditionalParameter()));
    450450                        else
    451                             return evaluation.configvalue_->set(evaluation.additionalParameter_);
     451                            return evaluation.configvalue_->set(removeSlashes(evaluation.additionalParameter_));
    452452                    }
    453453                    else if ((tokens.size() >= 1) && (tokens[0] == COMMAND_EXECUTOR_KEYWORD_SET_CONFIG_VALUE_TEMPORARY))
    454454                    {
    455455                        if (tokens.size() >= 4)
    456                             return evaluation.configvalue_->tset(tokens.subSet(3).join() + evaluation.getAdditionalParameter());
     456                            return evaluation.configvalue_->tset(removeSlashes(tokens.subSet(3).join() + evaluation.getAdditionalParameter()));
    457457                        else
    458                             return evaluation.configvalue_->tset(evaluation.additionalParameter_);
     458                            return evaluation.configvalue_->tset(removeSlashes(evaluation.additionalParameter_));
    459459                    }
    460460                }
  • code/branches/core2/src/orxonox/core/ConfigFileManager.cc

    r1049 r1050  
    7272            this->value_ = value;
    7373        else
    74             this->value_ = "\"" + addSlashes(value) + "\"";
     74            this->value_ = "\"" + addSlashes(stripEnclosingQuotes(value)) + "\"";
    7575    }
    7676
  • code/branches/core2/src/util/String.cc

    r1049 r1050  
    254254    std::string output = str;
    255255
    256     for (unsigned int pos = 0; (pos = output.find('\\', pos)) < std::string::npos; pos += 2) { output.replace(pos, 2, "\\\\"); }
    257     for (unsigned int pos = 0; (pos = output.find('\n', pos)) < std::string::npos; pos += 2) { output.replace(pos, 2, "\\n"); }
    258     for (unsigned int pos = 0; (pos = output.find('\t', pos)) < std::string::npos; pos += 2) { output.replace(pos, 2, "\\t"); }
    259     for (unsigned int pos = 0; (pos = output.find('\v', pos)) < std::string::npos; pos += 2) { output.replace(pos, 2, "\\v"); }
    260     for (unsigned int pos = 0; (pos = output.find('\b', pos)) < std::string::npos; pos += 2) { output.replace(pos, 2, "\\b"); }
    261     for (unsigned int pos = 0; (pos = output.find('\r', pos)) < std::string::npos; pos += 2) { output.replace(pos, 2, "\\r"); }
    262     for (unsigned int pos = 0; (pos = output.find('\f', pos)) < std::string::npos; pos += 2) { output.replace(pos, 2, "\\f"); }
    263     for (unsigned int pos = 0; (pos = output.find('\a', pos)) < std::string::npos; pos += 2) { output.replace(pos, 2, "\\a"); }
    264     for (unsigned int pos = 0; (pos = output.find('"', pos)) < std::string::npos; pos += 2) { output.replace(pos, 2, "\\\""); }
    265     for (unsigned int pos = 0; (pos = output.find('\0', pos)) < std::string::npos; pos += 2) { output.replace(pos, 2, "\\0"); }
     256    for (unsigned int pos = 0; (pos = output.find('\\', pos)) < std::string::npos; pos += 2) { output.replace(pos, 1, "\\\\"); }
     257    for (unsigned int pos = 0; (pos = output.find('\n', pos)) < std::string::npos; pos += 2) { output.replace(pos, 1, "\\n"); }
     258    for (unsigned int pos = 0; (pos = output.find('\t', pos)) < std::string::npos; pos += 2) { output.replace(pos, 1, "\\t"); }
     259    for (unsigned int pos = 0; (pos = output.find('\v', pos)) < std::string::npos; pos += 2) { output.replace(pos, 1, "\\v"); }
     260    for (unsigned int pos = 0; (pos = output.find('\b', pos)) < std::string::npos; pos += 2) { output.replace(pos, 1, "\\b"); }
     261    for (unsigned int pos = 0; (pos = output.find('\r', pos)) < std::string::npos; pos += 2) { output.replace(pos, 1, "\\r"); }
     262    for (unsigned int pos = 0; (pos = output.find('\f', pos)) < std::string::npos; pos += 2) { output.replace(pos, 1, "\\f"); }
     263    for (unsigned int pos = 0; (pos = output.find('\a', pos)) < std::string::npos; pos += 2) { output.replace(pos, 1, "\\a"); }
     264    for (unsigned int pos = 0; (pos = output.find('"', pos)) < std::string::npos; pos += 2) { output.replace(pos, 1, "\\\""); }
     265    for (unsigned int pos = 0; (pos = output.find('\0', pos)) < std::string::npos; pos += 2) { output.replace(pos, 1, "\\0"); }
    266266
    267267    return output;
     
    291291        output += str[pos];
    292292        pos++;
    293     }
    294     output += str[str.size() - 1];
     293        if (pos == str.size() - 1)
     294            output += str[pos];
     295    }
    295296
    296297    return output;
Note: See TracChangeset for help on using the changeset viewer.