From dfb18efed31a8b4f5585434d4a52c2f4ed471a94 Mon Sep 17 00:00:00 2001 From: Kimmo Varis Date: Mon, 8 Jun 2009 16:22:12 +0300 Subject: [PATCH] Fix #378 (GUI doesn't start application if path contains spaces) In Windows we must surround paths including spaces with quotation marks. This patch fixes application path when it is read from Browse-dialog. --- gui/applicationdialog.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/gui/applicationdialog.cpp b/gui/applicationdialog.cpp index d86006e72..e941ee421 100644 --- a/gui/applicationdialog.cpp +++ b/gui/applicationdialog.cpp @@ -82,7 +82,6 @@ ApplicationDialog::~ApplicationDialog() //dtor } - void ApplicationDialog::Browse() { QFileDialog dialog(this); @@ -93,7 +92,18 @@ void ApplicationDialog::Browse() QStringList list = dialog.selectedFiles(); if (list.size() > 0) { - mPath->setText(QDir::toNativeSeparators(list[0])); + QString path(QDir::toNativeSeparators(list[0])); + + // In Windows we must surround paths including spaces with quotation marks. +#ifdef Q_WS_WIN + if (path.indexOf(" ") > -1) + { + path.insert(0, "\""); + path.append("\""); + } +#endif // Q_WS_WIN + + mPath->setText(path); } } }