VirtualBox

Changeset 18819 in vbox for trunk/src


Ignore:
Timestamp:
Apr 7, 2009 1:02:43 PM (16 years ago)
Author:
vboxsync
Message:

Frontends/VBoxManage: when registering VMs try it with the client's idea of relative paths (by converting them to absolute). Helps with unexpected behavior of the API.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VBoxManage/VBoxManage.cpp

    r18783 r18819  
    201201
    202202    ComPtr<IMachine> machine;
    203     CHECK_ERROR(a->virtualBox, OpenMachine(Bstr(a->argv[0]), machine.asOutParam()));
     203    /** @todo Ugly hack to get both the API interpretation of relative paths
     204     * and the client's interpretation of relative paths. Remove after the API
     205     * has been redesigned. */
     206    rc = a->virtualBox->OpenMachine(Bstr(a->argv[0]), machine.asOutParam());
     207    if (rc == VBOX_E_FILE_ERROR)
     208    {
     209        char szVMFileAbs[RTPATH_MAX] = "";
     210        int vrc = RTPathAbs(a->argv[0], szVMFileAbs, sizeof(szVMFileAbs));
     211        if (RT_FAILURE(vrc))
     212        {
     213            RTPrintf("Cannot convert filename \"%s\" to absolute path\n", a->argv[0]);
     214            return 1;
     215        }
     216        CHECK_ERROR(a->virtualBox, OpenMachine(Bstr(szVMFileAbs), machine.asOutParam()));
     217    }
     218    else
     219        CHECK_ERROR(a->virtualBox, OpenMachine(Bstr(a->argv[0]), machine.asOutParam()));
    204220    if (SUCCEEDED(rc))
    205221    {
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