Q_OS_LINUX and Q_OS_ANDROID.



  • I am testing version 5.2 and 5.3 and have noticed no difference what operating system are you using and Q_OS_ANDROID Q_OS_LINUX.

    this is the code I've tried.

    @QStringList myOpenFile;
    QString mypath = QDir::currentPath();
    #ifdef Q_OS_WIN32
    myOpenFile << mypath+"/myfiles/oth/file.txt";
    #endif
    #ifdef Q_OS_LINUX
    myOpenFile << mypath+"/myfiles/oth/file.txt";
    #endif
    #ifdef Q_OS_ANDROID
    myOpenFile << "/mnt/sdcard/myfiles/oth/file.txt";
    #endif
    @
    using qDebug obtain two outputs:

    qDebug() << myOpenFile;

    /data/data/com.example.myprogra/files/myfiles/oth/file.txt
    /mnt/sdcard/myfiles/oth/file.txt

    This error only happens on android.



  • Android itself some kind of Linux so you'll see the output of Q_OS_LINUX and Q_OS_ANDROID under Android while you'll see single output under Windows or Linux



  • Try to use:
    [code]#if defined(Q_OS_ANDROID)
    qDebug() << "ANDROID";
    #elif defined(Q_OS_LINUX)
    qDebug() << "LINUX";
    #elif defined(Q_OS_WIN32)
    qDebug() << "WIN32";
    #endif[/code]


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.