From e190a005db288f0c5ba64d6e043d2e06e3b6e315 Mon Sep 17 00:00:00 2001 From: orignal Date: Fri, 17 Aug 2018 11:17:17 -0400 Subject: [PATCH] make sure assets are ready before proceed --- android/jni/DaemonAndroid.cpp | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/android/jni/DaemonAndroid.cpp b/android/jni/DaemonAndroid.cpp index 75584740..5ea5e495 100644 --- a/android/jni/DaemonAndroid.cpp +++ b/android/jni/DaemonAndroid.cpp @@ -1,10 +1,13 @@ -#include "DaemonAndroid.h" -#include "Daemon.h" #include +#include +#include +#include #include #include -#include //#include "mainwindow.h" +#include "FS.h" +#include "DaemonAndroid.h" +#include "Daemon.h" namespace i2p { @@ -80,6 +83,17 @@ namespace android //mutex=new QMutex(QMutex::Recursive); //setRunningCallback(0); //m_IsRunning=false; + + // make sure assets are ready before proceed + i2p::fs::DetectDataDir("", false); + int numAttempts = 0; + do + { + if (i2p::fs::Exists (i2p::fs::DataDirPath("assets.ready"))) break; // assets ready + numAttempts++; + std::this_thread::sleep_for (std::chrono::seconds(1)); // otherwise wait for 1 more second + } + while (numAttempts <= 10); // 10 seconds max return Daemon.init(argc,argv); }