Retroshare android service now run and start at boot on android, the qml app is still disfunctional

This commit is contained in:
Gio 2016-08-23 03:19:33 +02:00
parent 68a00138d2
commit 279551fe8d
36 changed files with 1076 additions and 79 deletions

View file

@ -881,3 +881,16 @@ test_bitdht {
# ENABLED UDP NOW.
}
android-g++ {
## Add this here and not in retroshare.pri because static library are very
## sensible to order in command line
LIBS += -L$$NDK_TOOLCHAIN_PATH/sysroot/usr/lib/ -lssl
INCLUDEPATH += $$NDK_TOOLCHAIN_PATH/sysroot/usr/include
DEPENDPATH += $$NDK_TOOLCHAIN_PATH/sysroot/usr/include
PRE_TARGETDEPS += $$NDK_TOOLCHAIN_PATH/sysroot/usr/lib/libssl.a
LIBS += -L$$NDK_TOOLCHAIN_PATH/sysroot/usr/lib/ -lcrypto
INCLUDEPATH += $$NDK_TOOLCHAIN_PATH/sysroot/usr/include
DEPENDPATH += $$NDK_TOOLCHAIN_PATH/sysroot/usr/include
PRE_TARGETDEPS += $$NDK_TOOLCHAIN_PATH/sysroot/usr/lib/libcrypto.a
}

View file

@ -129,15 +129,21 @@ class RsInit
namespace RsAccounts
{
// Directories.
std::string ConfigDirectory(); // aka Base Directory. (normally ~/.retroshare)
/**
* @brief ConfigDirectory (normally ~/.retroshare) you can call this method
* even before initialisation (you can't with some other methods)
* @see RsAccountsDetail::PathBaseDirectory()
*/
std::string ConfigDirectory();
/**
* @brief DataDirectory
* you can call this method even before initialisation (you can't with the other methods)
* you can call this method even before initialisation (you can't with some other methods)
* @param check if set to true and directory does not exist, return empty string
* @return path where global platform independent files are stored, like bdboot.txt or webinterface files
*/
std::string DataDirectory(bool check = true);
std::string PGPDirectory();
std::string AccountDirectory();

View file

@ -65,14 +65,8 @@ AccountDetails::AccountDetails()
return;
}
RsAccountsDetail::RsAccountsDetail()
:mAccountsLocked(false), mPreferredId(""), mBaseDirectory("")
{
mAccounts.clear();
mUnsupportedKeys.clear();
return;
}
RsAccountsDetail::RsAccountsDetail() : mAccountsLocked(false), mPreferredId("")
{}
bool RsAccountsDetail::loadAccounts()
{
@ -214,6 +208,7 @@ std::string RsAccountsDetail::PathPGPDirectory()
std::string RsAccountsDetail::PathBaseDirectory()
{
if(mBaseDirectory.empty()) defaultBaseDirectory();
return mBaseDirectory;
}
@ -326,8 +321,6 @@ bool RsAccountsDetail::setupBaseDirectory(std::string alt_basedir)
}
bool RsAccountsDetail::defaultBaseDirectory()
{
std::string basedir;
@ -339,8 +332,8 @@ bool RsAccountsDetail::defaultBaseDirectory()
char *h = getenv("HOME");
if (h == NULL)
{
std::cerr << "defaultBaseDirectory() Error: ";
std::cerr << "cannot determine $HOME dir" <<std::endl;
std::cerr << "defaultBaseDirectory() Error: cannot determine $HOME dir"
<< std::endl;
return false ;
}
@ -1254,7 +1247,7 @@ bool RsInit::LoadPassword(const std::string& id, const std::string& inPwd)
********************************************************************************/
// Directories.
std::string RsAccounts::ConfigDirectory() { return rsAccounts->PathBaseDirectory(); }
std::string RsAccounts::ConfigDirectory() { return RsAccountsDetail::PathBaseDirectory(); }
std::string RsAccounts::DataDirectory(bool check) { return RsAccountsDetail::PathDataDirectory(check); }
std::string RsAccounts::PGPDirectory() { return rsAccounts->PathPGPDirectory(); }
std::string RsAccounts::AccountDirectory() { return rsAccounts->PathAccountDirectory(); }
@ -1333,3 +1326,4 @@ bool RsAccounts::GenerateSSLCertificate(const RsPgpId& pgp_id, const std::str
* END OF: PUBLIC INTERFACE FUNCTIONS
********************************************************************************/
std::string RsAccountsDetail::mBaseDirectory;

View file

@ -80,7 +80,13 @@ class RsAccountsDetail
* @return path where global platform independent files are stored, like bdboot.txt or webinterface files
*/
static std::string PathDataDirectory(bool check = true);
std::string PathBaseDirectory();
/**
* @brief PathBaseDirectory
* @return path where user data is stored ( on Linux and similar
* systems it is usually something like /home/USERNAME/.retroshare ).
*/
static std::string PathBaseDirectory();
// PGP Path is only dependent on BaseDirectory.
std::string PathPGPDirectory();
@ -134,7 +140,7 @@ class RsAccountsDetail
private:
bool checkPreferredId();
bool defaultBaseDirectory();
static bool defaultBaseDirectory();
bool getAvailableAccounts(std::map<RsPeerId, AccountDetails> &accounts,
int& failing_accounts,
@ -148,7 +154,7 @@ class RsAccountsDetail
std::map<RsPeerId, AccountDetails> mAccounts;
RsPeerId mPreferredId;
std::string mBaseDirectory;
static std::string mBaseDirectory;
std::map<std::string,std::vector<std::string> > mUnsupportedKeys ;
};

View file

@ -507,7 +507,7 @@ int RsInit::InitRetroShare(int argcIgnored, char **argvIgnored, bool strictCheck
AuthSSL::AuthSSLInit();
AuthSSL::getAuthSSL() -> InitAuth(NULL, NULL, NULL, "");
rsAccounts = new RsAccountsDetail() ;
rsAccounts = new RsAccountsDetail();
// first check config directories, and set bootstrap values.
if(!rsAccounts->setupBaseDirectory(opt_base_dir))

View file

@ -32,10 +32,19 @@
#include "rsserver/rsaccounts.h"
#include "rsdiscspace.h"
#include <util/rsthreads.h>
#ifndef WIN32
#include <sys/statvfs.h>
#ifdef __ANDROID__
# include <android/api-level.h>
#endif
#ifdef WIN32
# include <wtypes.h>
#elif defined(__ANDROID__) && (__ANDROID_API__ < 21)
# include <sys/vfs.h>
# define statvfs64 statfs
# warning statvfs64 is not supported with android platform < 21 falling back to statfs that is untested (may misbehave)
#else
#include <wtypes.h>
# include <sys/statvfs.h>
#endif
#define DELAY_BETWEEN_CHECKS 2