summaryrefslogtreecommitdiffstats
path: root/rbutil
diff options
context:
space:
mode:
authorDominik Riebeling <Dominik.Riebeling@gmail.com>2007-08-29 12:32:53 +0000
committerDominik Riebeling <Dominik.Riebeling@gmail.com>2007-08-29 12:32:53 +0000
commitbc5a7e391c620008051a49a27180476192a325b7 (patch)
treee1618432d57ef6d8615304defc0b0205875fca34 /rbutil
parent57c2a5fa5a8b57a094e6e89aafa1702b76218da7 (diff)
downloadrockbox-bc5a7e391c620008051a49a27180476192a325b7.tar.gz
rockbox-bc5a7e391c620008051a49a27180476192a325b7.zip
make detection of tts / encoder binary by searching the path work on windows too. As MacOS AFAIK works the same was as Linux use the same method here -- hopefully this doesn't break anything.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@14509 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'rbutil')
-rw-r--r--rbutil/rbutilqt/configure.cpp38
1 files changed, 25 insertions, 13 deletions
diff --git a/rbutil/rbutilqt/configure.cpp b/rbutil/rbutilqt/configure.cpp
index 62a34d90a5..ca7fb94612 100644
--- a/rbutil/rbutilqt/configure.cpp
+++ b/rbutil/rbutilqt/configure.cpp
@@ -24,9 +24,7 @@
#include "ui_configurefrm.h"
#include "browsedirtree.h"
-#ifdef __linux
#include <stdio.h>
-#endif
#define DEFAULT_LANG "English (builtin)"
@@ -316,33 +314,40 @@ void Config::setDevices(QSettings *dev)
void Config::updateEncOpts(int index)
{
qDebug() << "updateEncOpts()";
- QString encoder;
+ QString e;
bool edit;
QString c = ui.comboEncoder->itemData(index, Qt::UserRole).toString();
devices->beginGroup(c);
ui.encoderOptions->setText(devices->value("options").toString());
edit = devices->value("edit").toBool();
ui.encoderOptions->setEnabled(edit);
- encoder = devices->value("encoder").toString();
+ e = devices->value("encoder").toString();
devices->endGroup();
// try to autodetect encoder
-#if defined(Q_OS_LINUX)
+#if defined(Q_OS_LINUX) || defined(Q_OS_MACX)
QStringList path = QString(getenv("PATH")).split(":", QString::SkipEmptyParts);
+#elif defined(Q_OS_WIN)
+ QStringList path = QString(getenv("PATH")).split(";", QString::SkipEmptyParts);
+#endif
qDebug() << path;
ui.encoderExecutable->setEnabled(true);
for(int i = 0; i < path.size(); i++) {
- QString executable = path.at(i) + "/" + encoder;
+ QString executable = QDir::fromNativeSeparators(path.at(i)) + "/" + e;
+#if defined(Q_OS_WIN)
+ executable += ".exe";
+ QStringList ex = executable.split("\"", QString::SkipEmptyParts);
+ executable = ex.join("");
+#endif
if(QFileInfo(executable).isExecutable()) {
qDebug() << "found:" << executable;
- ui.encoderExecutable->setText(executable);
+ ui.encoderExecutable->setText(QDir::toNativeSeparators(executable));
// disallow changing the detected path if non-customizable profile
if(!edit)
ui.encoderExecutable->setEnabled(false);
break;
}
}
-#endif
}
@@ -358,22 +363,29 @@ void Config::updateTtsOpts(int index)
e = devices->value("tts").toString();
devices->endGroup();
-#if defined(Q_OS_LINUX)
+#if defined(Q_OS_LINUX) || defined(Q_OS_MACX)
QStringList path = QString(getenv("PATH")).split(":", QString::SkipEmptyParts);
+#elif defined(Q_OS_WIN)
+ QStringList path = QString(getenv("PATH")).split(";", QString::SkipEmptyParts);
+#endif
qDebug() << path;
ui.ttsExecutable->setEnabled(true);
for(int i = 0; i < path.size(); i++) {
- QString executable = path.at(i) + "/" + e;
+ QString executable = QDir::fromNativeSeparators(path.at(i)) + "/" + e;
+#if defined(Q_OS_WIN)
+ executable += ".exe";
+ QStringList ex = executable.split("\"", QString::SkipEmptyParts);
+ executable = ex.join("");
+#endif
+ qDebug() << executable;
if(QFileInfo(executable).isExecutable()) {
- qDebug() << "found:" << executable;
- ui.ttsExecutable->setText(executable);
+ ui.ttsExecutable->setText(QDir::toNativeSeparators(executable));
// disallow changing the detected path if non-customizable profile
if(!edit)
ui.ttsExecutable->setEnabled(false);
break;
}
}
-#endif
}