VirtualBox

Changeset 33458 in vbox


Ignore:
Timestamp:
Oct 26, 2010 11:18:04 AM (15 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
67049
Message:

Main: partial revert or r67042, bring back the overwrite parameter

Location:
trunk
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/doc/manual/en_US/SDKRef.xml

    r33451 r33458  
    34463446          to creating machines in the default "Machines" folder, but can now
    34473447          create machines at arbitrary locations. For this to work, the
    3448           parameter list had to be changed. The "Override" parameter has been
    3449           removed since the target files can now be known before the call and
    3450           the caller can remove the files in question.</para>
     3448          parameter list had to be changed.</para>
    34513449        </listitem>
    34523450
  • trunk/src/VBox/Frontends/VBoxManage/VBoxManageMisc.cpp

    r33451 r33458  
    244244                                        osTypeId.raw(),
    245245                                        Guid(id).toUtf16().raw(),
     246                                        FALSE /* forceOverwrite */,
    246247                                        machine.asOutParam()));
    247248
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UINewVMWzd.cpp

    r33451 r33458  
    647647                                       field("name").toString(),
    648648                                       typeId,
    649                                        QString::null);      // machine ID
     649                                       QString::null,       // machine ID
     650                                       false);              // forceOverwrite
    650651        if (!vbox.isOk())
    651652        {
     
    659660            m_Machine.SetExtraData(VBoxDefs::GUI_FirstRun, "yes");
    660661    }
    661 
    662662
    663663    /* RAM size */
  • trunk/src/VBox/Main/ApplianceImplImport.cpp

    r33451 r33458  
    18201820                                    Bstr(stack.strOsTypeVBox).raw(),
    18211821                                    NULL, /* uuid */
     1822                                    FALSE, /* fForceOverwrite */
    18221823                                    pNewMachine.asOutParam());
    18231824    if (FAILED(rc)) throw rc;
  • trunk/src/VBox/Main/MachineImpl.cpp

    r33451 r33458  
    253253 *  @param strName      name for the machine
    254254 *  @param aId          UUID for the new machine.
    255  *  @param aOsType      Optional OS Type of this machine.
     255 *  @param aOsType      OS Type of this machine or NULL.
     256 *  @param fForceOverwrite Whether to overwrite an existing machine settings file.
    256257 *
    257258 *  @return  Success indicator. if not S_OK, the machine object is invalid
     
    260261                      const Utf8Str &strConfigFile,
    261262                      const Utf8Str &strName,
     263                      GuestOSType *aOsType,
    262264                      const Guid &aId,
    263                       GuestOSType *aOsType /* = NULL */)
     265                      bool fForceOverwrite)
    264266{
    265267    LogFlowThisFuncEnter();
     
    273275    if (FAILED(rc)) return rc;
    274276
    275     rc = tryCreateMachineConfigFile();
     277    rc = tryCreateMachineConfigFile(fForceOverwrite);
    276278    if (FAILED(rc)) return rc;
    277279
     
    473475    if (FAILED(rc)) return rc;
    474476
    475     rc = tryCreateMachineConfigFile();
     477    rc = tryCreateMachineConfigFile(false /* fForceOverwrite */);
    476478    if (FAILED(rc)) return rc;
    477479
     
    569571 * @return
    570572 */
    571 HRESULT Machine::tryCreateMachineConfigFile()
     573HRESULT Machine::tryCreateMachineConfigFile(bool fForceOverwrite)
    572574{
    573575    HRESULT rc = S_OK;
     
    582584        if (RT_SUCCESS(vrc))
    583585            RTFileClose(f);
    584         rc = setError(VBOX_E_FILE_ERROR,
    585                       tr("Machine settings file '%s' already exists"),
    586                       mData->m_strConfigFileFull.c_str());
     586        if (!fForceOverwrite)
     587            rc = setError(VBOX_E_FILE_ERROR,
     588                          tr("Machine settings file '%s' already exists"),
     589                          mData->m_strConfigFileFull.c_str());
     590        else
     591        {
     592            /* try to delete the config file, as otherwise the creation
     593             * of a new settings file will fail. */
     594            int vrc2 = RTFileDelete(mData->m_strConfigFileFull.c_str());
     595            if (RT_FAILURE(vrc2))
     596                rc = setError(VBOX_E_FILE_ERROR,
     597                              tr("Could not delete the existing settings file '%s' (%Rrc)"),
     598                              mData->m_strConfigFileFull.c_str(), vrc2);
     599        }
    587600    }
    588601    else if (    vrc != VERR_FILE_NOT_FOUND
  • trunk/src/VBox/Main/VirtualBoxImpl.cpp

    r33451 r33458  
    11981198                                       IN_BSTR aOsTypeId,
    11991199                                       IN_BSTR aId,
     1200                                       BOOL forceOverwrite,
    12001201                                       IMachine **aMachine)
    12011202{
     
    12391240                       Utf8Str(bstrSettingsFile),
    12401241                       Utf8Str(aName),
     1242                       osType,
    12411243                       id,
    1242                        osType);
     1244                       !!forceOverwrite);
    12431245    if (SUCCEEDED(rc))
    12441246    {
  • trunk/src/VBox/Main/idl/VirtualBox.xidl

    r33452 r33458  
    13741374  <interface
    13751375    name="IVirtualBox" extends="$unknown"
    1376     uuid="4bbb7840-f46a-4672-90e2-c4bf65c3c74c"
     1376    uuid="6e123115-af60-49b3-9727-d3f302306cd2"
    13771377    wsmap="managed"
    13781378  >
     
    16571657      <param name="id" type="uuid" mod="string" dir="in">
    16581658        <desc>Machine UUID (optional).</desc>
     1659      </param>
     1660      <param name="forceOverwrite" type="boolean" dir="in">
     1661        <desc>If true, an existing machine settings file will be overwritten.</desc>
    16591662      </param>
    16601663      <param name="machine" type="IMachine" dir="return">
  • trunk/src/VBox/Main/include/MachineImpl.h

    r33451 r33458  
    332332                 const Utf8Str &strConfigFile,
    333333                 const Utf8Str &strName,
     334                 GuestOSType *aOsType,
    334335                 const Guid &aId,
    335                  GuestOSType *aOsType = NULL);
     336                 bool fForceOverwrite);
    336337
    337338    // initializer for loading existing machine XML (either registered or not)
     
    357358    HRESULT initDataAndChildObjects();
    358359    HRESULT registeredInit();
    359     HRESULT tryCreateMachineConfigFile();
     360    HRESULT tryCreateMachineConfigFile(bool fForceOverwrite);
    360361    void uninitDataAndChildObjects();
    361362
  • trunk/src/VBox/Main/include/VirtualBoxImpl.h

    r33451 r33458  
    127127                              IN_BSTR aOsTypeId,
    128128                              IN_BSTR aId,
     129                              BOOL forceOverwrite,
    129130                              IMachine **aMachine);
    130131    STDMETHOD(OpenMachine) (IN_BSTR aSettingsFile, IMachine **aMachine);
  • trunk/src/VBox/Main/testcase/tstVBoxAPILinux.cpp

    r33451 r33458  
    190190     */
    191191    nsCOMPtr<IMachine> machine;
    192     rc = virtualBox->CreateMachine(NULL,
     192    rc = virtualBox->CreateMachine(NULL,        /* settings file */
    193193                                   NS_LITERAL_STRING("A brand new name").get(),
    194                                    nsnull,
    195                                    false,
     194                                   nsnull,      /* ostype */
     195                                   nsnull,      /* machine uuid */
     196                                   false,       /* forceOverwrite */
    196197                                   getter_AddRefs(machine));
    197198    if (NS_FAILED(rc))
Note: See TracChangeset for help on using the changeset viewer.

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