fix example 'swank-server' to work again on mobile; revisions

This commit is contained in:
pls.153 2022-03-09 14:44:49 +01:00
parent fc662c4f48
commit 5f3b251a69
9 changed files with 59 additions and 44 deletions

View file

@ -79,6 +79,27 @@ int main(int argc, char* argv[]) {
lqml.ignoreIOStreams();
#endif
// load .eclrc
if (arguments.contains("-norc")) {
arguments.removeAll("-norc");
} else {
#if (defined Q_OS_ANDROID) || (defined Q_OS_IOS)
// mobile: don't hang on startup
LQML::eval("(x:when-it (probe-file \"~/.eclrc\")"
" (ignore-errors (load x:it)))");
#else
LQML::eval("(x:when-it (probe-file \"~/.eclrc\")"
" (load x:it))");
#endif
}
// load Lisp file
QStringList files = arguments.filter(".lisp");
if (!files.isEmpty()) {
QString file = QDir::fromNativeSeparators(files.first());
LQML::eval(QString("(load \"%1\")").arg(file), true);
}
new QQmlFileSelector(view.engine(), &view);
QString qml("qml/main.qml");
QUrl url;
@ -97,20 +118,6 @@ int main(int argc, char* argv[]) {
#endif
}
// load .eclrc
if (arguments.contains("-norc")) {
arguments.removeAll("-norc");
} else {
#if (defined Q_OS_ANDROID) || (defined Q_OS_IOS)
// mobile: don't hang on startup
LQML::eval("(x:when-it (probe-file \"~/.eclrc\")"
" (ignore-errors (load x:it)))");
#else
LQML::eval("(x:when-it (probe-file \"~/.eclrc\")"
" (load x:it))");
#endif
}
#ifdef INI_ECL_CONTRIB
// for iOS; ASDF is loaded on demand (slow)
ecl_init_module(NULL, init_lib_DEFLATE);
@ -137,13 +144,6 @@ int main(int argc, char* argv[]) {
qtRestart = true;
}
// load Lisp file
QStringList files = arguments.filter(".lisp");
if (!files.isEmpty()) {
QString file = QDir::fromNativeSeparators(files.first());
LQML::eval(QString("(load \"%1\")").arg(file), true);
}
if (qtRestart) {
LQML::eval("(qml::exec-with-qt-restart)", true);
return 0;