diff options
Diffstat (limited to 'src/main.cpp')
| -rw-r--r-- | src/main.cpp | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/src/main.cpp b/src/main.cpp index 81e10dc..6f3d283 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -36,7 +36,7 @@ int main(int argc, char *argv[]) /* Parse cmdline argus. */ QMap<QString, QString> clo; int longIndex = 0; - static const char *optString = "u:hDd"; + static const char *optString = "u:hDd:"; static const struct option longOpts[] = { {"url", required_argument, NULL, 'u'}, @@ -53,14 +53,15 @@ int main(int argc, char *argv[]) clo.insert("url", optarg); break; case 'd': - clo.insert("downloadDir", optarg); - break; + qDebug() << "Read from CLO: DD = " << optarg; + clo.insert("downloadDir", optarg); + break; case 'D': - clo.insert("debug", "debug"); - break; + clo.insert("debug", "debug"); + break; case 'h': - clo.insert("help", "help"); - break; + clo.insert("help", "help"); + break; } opt = getopt_long(argc, argv, optString, longOpts, &longIndex); } @@ -83,10 +84,14 @@ int main(int argc, char *argv[]) else baseURL = DEFAULT_URL; - if (clo.contains("downloadDir")) + if (clo.contains("downloadDir")){ downloadDirectory = QDir(clo.value("downloadDir")); - else if (confFileSettings.contains("default/downloadDirectory")) + if (debug) qDebug() << "downloadDir set to: " << clo.value("downloadDir"); + } + else if (confFileSettings.contains("default/downloadDirectory")){ downloadDirectory = QDir(confFileSettings.value("default/downloadDirectory").toString()); + if (debug) qDebug() << "downloadDir set to: " << confFileSettings.value("default/downloadDirectory").toString(); + } else downloadDirectory = QDir("."); if (debug) qDebug() << "Downloads will be saved to: " << downloadDirectory.dirName(); |
