diff options
author | Dominik Wenger <domonoky@googlemail.com> | 2009-04-29 21:27:01 +0000 |
---|---|---|
committer | Dominik Wenger <domonoky@googlemail.com> | 2009-04-29 21:27:01 +0000 |
commit | 5b85ef6006ae8e88694c62806f7f178eab4d3ba9 (patch) | |
tree | 19555e6dd782823b5329e871d6d8bea5bca7980d /rbutil/rbutilqt/base/utils.cpp | |
parent | 3d2e42ab4cc6306db4036983badea0c92750210b (diff) |
rbutil: completely rework how tts and encoders are configured. (FS#10070)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@20824 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'rbutil/rbutilqt/base/utils.cpp')
-rw-r--r-- | rbutil/rbutilqt/base/utils.cpp | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/rbutil/rbutilqt/base/utils.cpp b/rbutil/rbutilqt/base/utils.cpp index 4b76c6497a..966ce335ea 100644 --- a/rbutil/rbutilqt/base/utils.cpp +++ b/rbutil/rbutilqt/base/utils.cpp @@ -130,6 +130,35 @@ qulonglong filesystemFree(QString path) return size; } +//! \brief searches for a Executable in the Environement Path +QString findExecutable(QString name) +{ + QString exepath; + //try autodetect tts +#if defined(Q_OS_LINUX) || defined(Q_OS_MACX) || defined(Q_OS_OPENBSD) + QStringList path = QString(getenv("PATH")).split(":", QString::SkipEmptyParts); +#elif defined(Q_OS_WIN) + QStringList path = QString(getenv("PATH")).split(";", QString::SkipEmptyParts); +#endif + qDebug() << path; + for(int i = 0; i < path.size(); i++) + { + QString executable = QDir::fromNativeSeparators(path.at(i)) + "/" + name; +#if defined(Q_OS_WIN) + executable += ".exe"; + QStringList ex = executable.split("\"", QString::SkipEmptyParts); + executable = ex.join(""); +#endif + qDebug() << executable; + if(QFileInfo(executable).isExecutable()) + { + return QDir::toNativeSeparators(executable); + } + } + return ""; +} + + RockboxInfo::RockboxInfo(QString mountpoint) { m_path = mountpoint +"/.rockbox/rockbox-info.txt"; |