projects
/
quassel.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Added a commandline option to specify the datadir (the dir containing sqlite db and...
[quassel.git]
/
src
/
common
/
cliparser.cpp
diff --git
a/src/common/cliparser.cpp
b/src/common/cliparser.cpp
index
e3b8add
..
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>
@@
-38,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) {
@@
-54,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) {
@@
-73,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) {