VirtualBox

Ignore:
Timestamp:
Jan 7, 2009 1:27:20 PM (16 years ago)
Author:
vboxsync
Message:

VBoxGlobal.cpp: Made the RTSystemQueryOSInfo the default fallback and changed it to omit empty strings.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox4/src/VBoxGlobal.cpp

    r15822 r15832  
    8989#include <iprt/file.h>
    9090#include <iprt/ldr.h>
    91 
    92 #if defined (Q_OS_MACX) || defined (Q_OS_SOLARIS) /* platform info */
    9391#include <iprt/system.h>
    94 #endif
    9592
    9693#ifdef VBOX_GUI_WITH_SYSTRAY
     
    26362633            distrib = QString ("Unknown %1");
    26372634    }
    2638     else
     2635    else /** @todo Windows Server 2008 == vista? Probably not... */
    26392636        distrib = QString ("Unknown %1");
    26402637    distrib = distrib.arg (sp);
     
    26432640    platform += QString (" [Distribution: %1 | Version: %2 | Build: %3]")
    26442641        .arg (distrib).arg (version).arg (kernel);
    2645 #elif defined (Q_OS_OS2)
    2646     // TODO: add sys info for os2 if any...
    26472642#elif defined (Q_OS_LINUX)
    26482643    /* Get script path */
     
    26552650    if (!result.isNull())
    26562651        platform += QString (" [%1]").arg (QString (result).trimmed());
    2657 #elif defined (Q_OS_MACX) || defined (Q_OS_SOLARIS) || defined (Q_OS_FREEBSD)
     2652#else
     2653    /* Use RTSystemQueryOSInfo. */
    26582654    char szTmp[256];
    26592655    QStringList components;
    2660     int vrc = RTSystemQueryOSInfo (RTSYSOSINFO_PRODUCT, szTmp, sizeof(szTmp));
    2661     if (RT_SUCCESS (vrc) || vrc == VERR_BUFFER_OVERFLOW)
     2656    int vrc = RTSystemQueryOSInfo (RTSYSOSINFO_PRODUCT, szTmp, sizeof (szTmp));
     2657    if ((RT_SUCCESS (vrc) || vrc == VERR_BUFFER_OVERFLOW) && szTmp[0] != '\0')
    26622658        components << QString ("Product: %1").arg (szTmp);
    2663     vrc = RTSystemQueryOSInfo (RTSYSOSINFO_RELEASE, szTmp, sizeof(szTmp));
    2664     if (RT_SUCCESS (vrc) || vrc == VERR_BUFFER_OVERFLOW)
     2659    vrc = RTSystemQueryOSInfo (RTSYSOSINFO_RELEASE, szTmp, sizeof (szTmp));
     2660    if ((RT_SUCCESS (vrc) || vrc == VERR_BUFFER_OVERFLOW) && szTmp[0] != '\0')
    26652661        components << QString ("Release: %1").arg (szTmp);
    2666     vrc = RTSystemQueryOSInfo (RTSYSOSINFO_VERSION, szTmp, sizeof(szTmp));
    2667     if (RT_SUCCESS (vrc) || vrc == VERR_BUFFER_OVERFLOW)
     2662    vrc = RTSystemQueryOSInfo (RTSYSOSINFO_VERSION, szTmp, sizeof (szTmp));
     2663    if ((RT_SUCCESS (vrc) || vrc == VERR_BUFFER_OVERFLOW) && szTmp[0] != '\0')
    26682664        components << QString ("Version: %1").arg (szTmp);
    2669     vrc = RTSystemQueryOSInfo (RTSYSOSINFO_SERVICE_PACK, szTmp, sizeof(szTmp));
    2670     if (RT_SUCCESS (vrc) || vrc == VERR_BUFFER_OVERFLOW)
     2665    vrc = RTSystemQueryOSInfo (RTSYSOSINFO_SERVICE_PACK, szTmp, sizeof (szTmp));
     2666    if ((RT_SUCCESS (vrc) || vrc == VERR_BUFFER_OVERFLOW) && szTmp[0] != '\0')
    26712667        components << QString ("SP: %1").arg (szTmp);
    2672     platform += QString (" [%1]").arg (components.join (" | "));
     2668    if (!components.isEmpty())
     2669        platform += QString (" [%1]").arg (components.join (" | "));
    26732670#endif
    26742671
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette