From a8fd7c7b0a89e063d62cf130c5044d5b5d23f467 Mon Sep 17 00:00:00 2001 From: BogDan Vatra Date: Sat, 20 Sep 2014 11:23:06 +0300 Subject: [PATCH] Make sure the outputDirectory contains the full path not relative. Trying to run a process using the relative path on windows fails. Task-number: QTBUG-41431 Change-Id: I0c9aa837dc7a556372b1018feb2f7f5c14c2652a Reviewed-by: Venugopal Shivashankar Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/androiddeployqt/main.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/androiddeployqt/main.cpp b/src/androiddeployqt/main.cpp index 9184679..b4ae258 100644 --- a/src/androiddeployqt/main.cpp +++ b/src/androiddeployqt/main.cpp @@ -322,11 +322,8 @@ Options parseOptions() if (argument.compare(QLatin1String("--output"), Qt::CaseInsensitive) == 0) { if (i + 1 == arguments.size()) options.helpRequested = true; - else { + else options.outputDirectory = arguments.at(++i).trimmed(); - if (!options.outputDirectory.endsWith(QLatin1Char('/'))) - options.outputDirectory += QLatin1Char('/'); - } } else if (argument.compare(QLatin1String("--input"), Qt::CaseInsensitive) == 0) { if (i + 1 == arguments.size()) options.helpRequested = true; @@ -460,6 +457,15 @@ Options parseOptions() options.timing = qEnvironmentVariableIsSet("ANDROIDDEPLOYQT_TIMING_OUTPUT"); + if (!QDir::current().mkpath(options.outputDirectory)) { + fprintf(stderr, "Invalid output directory: %s\n", qPrintable(options.outputDirectory)); + options.outputDirectory.clear(); + } else { + options.outputDirectory = QFileInfo(options.outputDirectory).canonicalFilePath(); + if (!options.outputDirectory.endsWith(QLatin1Char('/'))) + options.outputDirectory += QLatin1Char('/'); + } + return options; } -- 2.7.4