projects
/
quassel.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Internal stuff only.
[quassel.git]
/
src
/
common
/
cliparser.cpp
diff --git
a/src/common/cliparser.cpp
b/src/common/cliparser.cpp
index
3b0064e
..
c4ca9b8
100644
(file)
--- a/
src/common/cliparser.cpp
+++ b/
src/common/cliparser.cpp
@@
-19,6
+19,7
@@
***************************************************************************/
#include "cliparser.h"
***************************************************************************/
#include "cliparser.h"
+#include <QDir>
#include <QString>
#include <QFileInfo>
#include <QDebug>
#include <QString>
#include <QFileInfo>
#include <QDebug>
@@
-26,10
+27,6
@@
CliParser::CliParser(QStringList arguments)
{
argsRaw = arguments;
CliParser::CliParser(QStringList arguments)
{
argsRaw = arguments;
-// remove Qt internal debugging arguments
- argsRaw.removeOne("-sync");
- argsRaw.removeOne("-nograb");
- argsRaw.removeOne("-dograb");
}
void CliParser::addArgument(const QString &longName, const CliParserArg &arg) {
}
void CliParser::addArgument(const QString &longName, const CliParserArg &arg) {
@@
-42,7
+39,7
@@
void CliParser::addArgument(const QString &longName, const CliParserArg &arg) {
bool CliParser::addLongArg(const CliParserArg::CliArgType type, const QString &name, const QString &value) {
if(argsHash.contains(name)){
if(type == CliParserArg::CliArgOption && argsHash.value(name).type == type) {
bool CliParser::addLongArg(const CliParserArg::CliArgType type, const QString &name, const QString &value) {
if(argsHash.contains(name)){
if(type == CliParserArg::CliArgOption && argsHash.value(name).type == type) {
- argsHash[name].value =
value
;
+ argsHash[name].value =
escapedValue(value)
;
return true;
}
else if (type == CliParserArg::CliArgSwitch && argsHash.value(name).type == type) {
return true;
}
else if (type == CliParserArg::CliArgSwitch && argsHash.value(name).type == type) {
@@
-58,7
+55,7
@@
bool CliParser::addShortArg(const CliParserArg::CliArgType type, const char shor
QString longName = lnameOfShortArg(shortName);
if(!longName.isNull()) {
if(type == CliParserArg::CliArgOption && argsHash.value(longName).type == type) {
QString longName = lnameOfShortArg(shortName);
if(!longName.isNull()) {
if(type == CliParserArg::CliArgOption && argsHash.value(longName).type == type) {
- argsHash[longName].value =
value
;
+ argsHash[longName].value =
escapedValue(value)
;
return true;
}
else if (type == CliParserArg::CliArgSwitch) {
return true;
}
else if (type == CliParserArg::CliArgSwitch) {
@@
-77,6
+74,14
@@
bool CliParser::addShortArg(const CliParserArg::CliArgType type, const char shor
return false;
}
return false;
}
+QString CliParser::escapedValue(const QString &value) {
+ QString escapedValue = value;
+ if(escapedValue.startsWith("~"))
+ escapedValue.replace(0, 1, QDir::homePath());
+
+ return escapedValue;
+}
+
bool CliParser::parse() {
QStringList::const_iterator currentArg;
for (currentArg = argsRaw.constBegin(); currentArg != argsRaw.constEnd(); ++currentArg) {
bool CliParser::parse() {
QStringList::const_iterator currentArg;
for (currentArg = argsRaw.constBegin(); currentArg != argsRaw.constEnd(); ++currentArg) {