diff options
-rw-r--r-- | main.cpp | 9 | ||||
-rw-r--r-- | process.cpp | 74 | ||||
-rw-r--r-- | process.h | 9 |
3 files changed, 2 insertions, 90 deletions
@@ -38,11 +38,7 @@ #define PID_FILE "/data/user/.appcontroller" #define FEATURES "restart perf eglresize qmldebugservices" -#ifdef Q_OS_ANDROID - #define B2QT_PREFIX "/data/user/b2qt" -#else - #define B2QT_PREFIX "/usr/bin/b2qt" -#endif +#define B2QT_PREFIX "/usr/bin/b2qt" static int serverSocket = -1; @@ -66,7 +62,6 @@ static void usage() "--show-platform Show platform information\n" "--make-default Make this application the default on boot\n" "--remove-default Restore the default application\n" - "--print-debug Print debug messages to stdout on Android\n" "--version Print version information\n" "--detach Start application as usual, then go into background\n" "--restart Restart the current running application or an\n" @@ -386,8 +381,6 @@ int main(int argc, char **argv) return 0; else return 1; - } else if (arg == "--print-debug") { - config.flags |= Config::PrintDebugMessages; } else if (arg == "--version") { printf("Appcontroller version: " GIT_VERSION "\nGit revision: " GIT_HASH "\nFeatures: " FEATURES "\n"); return 0; diff --git a/process.cpp b/process.cpp index d3d8fdb..2ee9246 100644 --- a/process.cpp +++ b/process.cpp @@ -144,12 +144,8 @@ void Process::forwardProcessOutput(qintptr fd, const QByteArray &data) size -= written; constData += written; } - - if (mConfig.flags.testFlag(Config::PrintDebugMessages)) - qDebug() << data; } - void Process::readyReadStandardOutput() { forwardProcessOutput(mStdoutFd, mProcess->readAllStandardOutput()); @@ -214,11 +210,7 @@ void Process::finished(int exitCode, QProcess::ExitStatus exitStatus) void Process::startup() { -#ifdef Q_OS_ANDROID - QProcessEnvironment pe = interactiveProcessEnvironment(); -#else QProcessEnvironment pe = QProcessEnvironment::systemEnvironment(); -#endif QStringList args = mStartupArguments; mBeingRestarted = false; @@ -341,69 +333,3 @@ void Process::setStdoutFd(qintptr stdoutFd) { mStdoutFd = stdoutFd; } - -QProcessEnvironment Process::interactiveProcessEnvironment() const -{ - QProcessEnvironment env; - - QProcess process; - process.start("sh"); - if (!process.waitForStarted(3000)) { - printf("Could not start shell.\n"); - return env; - } - - process.write("source /system/etc/mkshrc\n"); - process.write("export -p\n"); - process.closeWriteChannel(); - - printf("waiting for process to finish\n"); - if (!process.waitForFinished(1000)) { - printf("did not finish: terminate\n"); - process.terminate(); - if (!process.waitForFinished(1000)) { - printf("did not terminate: kill\n"); - process.kill(); - if (!process.waitForFinished(1000)) { - printf("Could not stop process.\n"); - } - } - } - - QList<QByteArray> list = process.readAllStandardOutput().split('\n'); - if (list.isEmpty()) - printf("Failed to read environment output\n"); - - foreach (QByteArray entry, list) { - if (entry.startsWith("export ")) { - entry = entry.mid(7); - } else if (entry.startsWith("declare -x ")) { - entry = entry.mid(11); - } else { - continue; - } - - QByteArray key; - QByteArray value; - int index = entry.indexOf('='); - - if (index > 0) { - key = entry.left(index); - value = entry.mid(index + 1); - } else { - key = entry; - // value is empty - } - - // Remove simple escaping. - // This is not complete. - if (value.startsWith('\'') and value.endsWith('\'')) - value = value.mid(1, value.size()-2); - else if (value.startsWith('"') and value.endsWith('"')) - value = value.mid(1, value.size()-2); - - env.insert(key, value); - } - - return env; -} @@ -27,23 +27,17 @@ class QSocketNotifier; struct Config { - enum Flag { - PrintDebugMessages = 0x01 - }; - Q_DECLARE_FLAGS(Flags, Flag) - enum DebugInterface{ LocalDebugInterface, PublicDebugInterface }; - Config() : platform("unknown"), flags(0), debugInterface(LocalDebugInterface) { } + Config() : platform("unknown"), debugInterface(LocalDebugInterface) { } QString base; QString platform; QMap<QString,QString> env; QStringList args; - Flags flags; DebugInterface debugInterface; }; @@ -71,7 +65,6 @@ private slots: private: void forwardProcessOutput(qintptr fd, const QByteArray &data); void startup(); - QProcessEnvironment interactiveProcessEnvironment() const; QProcess *mProcess; int mDebuggee; bool mDebug; |