VirtualBox

Changeset 85524 in vbox for trunk


Ignore:
Timestamp:
Jul 29, 2020 12:58:57 PM (4 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:9722: VirtualBox Manager: One possible way to execute cloud console connection command by opening it via Open command.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/UIVirtualBoxManager.cpp

    r85486 r85524  
    7878#include "CUnattended.h"
    7979#include "CVirtualBoxErrorInfo.h"
     80#ifdef VBOX_WS_MAC
     81# include "CVirtualBox.h"
     82#endif
    8083
    8184/* Other VBox stuff: */
     
    12751278    const CCloudMachine comMachine = pCloudItem->machine();
    12761279
    1277 #ifdef VBOX_WS_WIN
     1280#if defined(VBOX_WS_WIN)
    12781281    /* Gather arguments: */
    12791282    QStringList arguments;
     
    12831286    /* Execute console application finally: */
    12841287    QProcess::startDetached(QString("%1 %2").arg(strPath, arguments.join(' ')));
    1285 #else /* !VBOX_WS_WIN */
     1288#elif defined(VBOX_WS_MAC)
     1289    /* Gather arguments: */
     1290    QStringList arguments;
     1291    arguments << parseShellArguments(strArguments);
     1292
     1293    /* Make sure that isn't a request to start Open command: */
     1294    if (strPath != "open" && strPath != "/usr/bin/open")
     1295    {
     1296        /* In that case just add the command we have as simple argument: */
     1297        arguments << comMachine.GetSerialConsoleCommand();
     1298    }
     1299    else
     1300    {
     1301        /* Otherwise upload command to external file which can be opened with Open command: */
     1302        QDir uiHomeFolder(uiCommon().virtualBox().GetHomeFolder());
     1303        const QString strAbsoluteCommandName = uiHomeFolder.absoluteFilePath("last.command");
     1304        QFile file(strAbsoluteCommandName);
     1305        file.setPermissions(QFileDevice::ReadOwner | QFileDevice::WriteOwner | QFileDevice::ExeOwner);
     1306        if (!file.open(QIODevice::WriteOnly))
     1307            AssertFailedReturnVoid();
     1308        file.write(comMachine.GetSerialConsoleCommand().toUtf8());
     1309        file.close();
     1310        arguments << strAbsoluteCommandName;
     1311    }
     1312
     1313    /* Execute console application finally: */
     1314    QProcess::startDetached(strPath, arguments);
     1315#else /* !VBOX_WS_WIN && !VBOX_WS_MAC */
    12861316    /* Gather arguments: */
    12871317    QStringList arguments;
     
    12911321    /* Execute console application finally: */
    12921322    QProcess::startDetached(strPath, arguments);
    1293 #endif /* !VBOX_WS_WIN */
     1323#endif /* !VBOX_WS_WIN && !VBOX_WS_MAC */
    12941324}
    12951325
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