Changeset 43041 in vbox for trunk/src/VBox/Main/src-server
- Timestamp:
- Aug 28, 2012 1:58:40 PM (13 years ago)
- svn:sync-xref-src-repo-rev:
- 80375
- Location:
- trunk/src/VBox/Main/src-server
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/src-server/ApplianceImplImport.cpp
r42708 r43041 206 206 rc = mVirtualBox->ComposeMachineFilename(Bstr(nameVBox).raw(), 207 207 NULL /* aGroup */, 208 NULL /* aCreateFlags */, 208 209 NULL /* aBaseFolder */, 209 210 bstrMachineFilename.asOutParam()); … … 1954 1955 ComSafeArrayAsInParam(groups), 1955 1956 Bstr(stack.strOsTypeVBox).raw(), 1956 NULL, /* uuid */ 1957 FALSE, /* fForceOverwrite */ 1957 NULL, /* aCreateFlags */ 1958 1958 pNewMachine.asOutParam()); 1959 1959 if (FAILED(rc)) throw rc; … … 2868 2868 rc = mVirtualBox->ComposeMachineFilename(Bstr(stack.strNameVBox).raw(), 2869 2869 NULL /* aGroup */, 2870 NULL /* aCreateFlags */, 2870 2871 NULL /* aBaseFolder */, 2871 2872 bstrMachineFilename.asOutParam()); -
trunk/src/VBox/Main/src-server/MachineImpl.cpp
r43023 r43041 290 290 GuestOSType *aOsType, 291 291 const Guid &aId, 292 bool fForceOverwrite) 292 bool fForceOverwrite, 293 bool fDirectoryIncludesUUID) 293 294 { 294 295 LogFlowThisFuncEnter(); … … 324 325 mUserData->s.llGroups = llGroups; 325 326 327 mUserData->s.fDirectoryIncludesUUID = fDirectoryIncludesUUID; 326 328 // the "name sync" flag determines whether the machine directory gets renamed along 327 329 // with the machine file; say so if the settings file name is the same as the … … 10946 10948 strConfigFileOnly.stripPath() // vmname.vbox 10947 10949 .stripExt(); // vmname 10950 /** @todo hack, make somehow use of ComposeMachineFilename */ 10951 if (mUserData->s.fDirectoryIncludesUUID) 10952 strConfigFileOnly += Utf8StrFmt(" (%RTuuid)", mData->mUuid.raw()); 10948 10953 10949 10954 AssertReturn(!strMachineDirName.isEmpty(), false); -
trunk/src/VBox/Main/src-server/VirtualBoxImpl.cpp
r42957 r43041 1406 1406 STDMETHODIMP VirtualBox::ComposeMachineFilename(IN_BSTR aName, 1407 1407 IN_BSTR aGroup, 1408 IN_BSTR aCreateFlags, 1408 1409 IN_BSTR aBaseFolder, 1409 1410 BSTR *aFilename) … … 1417 1418 AutoCaller autoCaller(this); 1418 1419 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 1420 1421 Utf8Str strCreateFlags(aCreateFlags); 1422 Guid id; 1423 bool fDirectoryIncludesUUID = false; 1424 if (!strCreateFlags.isEmpty()) 1425 { 1426 const char *pcszNext = strCreateFlags.c_str(); 1427 while (*pcszNext != '\0') 1428 { 1429 Utf8Str strFlag; 1430 const char *pcszComma = RTStrStr(pcszNext, ","); 1431 if (!pcszComma) 1432 strFlag = pcszNext; 1433 else 1434 strFlag = Utf8Str(pcszNext, pcszComma - pcszNext); 1435 1436 const char *pcszEqual = RTStrStr(strFlag.c_str(), "="); 1437 /* skip over everything which doesn't contain '=' */ 1438 if (pcszEqual && pcszEqual != strFlag.c_str()) 1439 { 1440 Utf8Str strKey(strFlag.c_str(), pcszEqual - strFlag.c_str()); 1441 Utf8Str strValue(strFlag.c_str() + (pcszEqual - strFlag.c_str() + 1)); 1442 1443 if (strKey == "UUID") 1444 id = strValue.c_str(); 1445 else if (strKey == "directoryIncludesUUID") 1446 fDirectoryIncludesUUID = (strValue == "1"); 1447 } 1448 1449 if (!pcszComma) 1450 pcszNext += strFlag.length(); 1451 else 1452 pcszNext += strFlag.length() + 1; 1453 } 1454 } 1455 if (id.isEmpty()) 1456 fDirectoryIncludesUUID = false; 1419 1457 1420 1458 Utf8Str strGroup(aGroup); … … 1436 1474 Utf8Str strBase = aBaseFolder; 1437 1475 Utf8Str strName = aName; 1476 Utf8Str strDirName(strName); 1477 if (fDirectoryIncludesUUID) 1478 strDirName += Utf8StrFmt(" (%RTuuid)", id.raw()); 1438 1479 sanitiseMachineFilename(strName); 1480 sanitiseMachineFilename(strDirName); 1439 1481 1440 1482 if (strBase.isEmpty()) … … 1551 1593 ComSafeArrayIn(IN_BSTR, aGroups), 1552 1594 IN_BSTR aOsTypeId, 1553 IN_BSTR aId, 1554 BOOL forceOverwrite, 1595 IN_BSTR aCreateFlags, 1555 1596 IMachine **aMachine) 1556 1597 { 1557 1598 LogFlowThisFuncEnter(); 1558 LogFlowThisFunc(("aSettingsFile=\"%ls\", aName=\"%ls\", aOsTypeId =\"%ls\" \n", aSettingsFile, aName, aOsTypeId));1599 LogFlowThisFunc(("aSettingsFile=\"%ls\", aName=\"%ls\", aOsTypeId =\"%ls\", aCreateFlags=\"%ls\"\n", aSettingsFile, aName, aOsTypeId, aCreateFlags)); 1559 1600 1560 1601 CheckComArgStrNotEmptyOrNull(aName); … … 1570 1611 return rc; 1571 1612 1613 Utf8Str strCreateFlags(aCreateFlags); 1614 Guid id; 1615 bool fForceOverwrite = false; 1616 bool fDirectoryIncludesUUID = false; 1617 if (!strCreateFlags.isEmpty()) 1618 { 1619 const char *pcszNext = strCreateFlags.c_str(); 1620 while (*pcszNext != '\0') 1621 { 1622 Utf8Str strFlag; 1623 const char *pcszComma = RTStrStr(pcszNext, ","); 1624 if (!pcszComma) 1625 strFlag = pcszNext; 1626 else 1627 strFlag = Utf8Str(pcszNext, pcszComma - pcszNext); 1628 1629 const char *pcszEqual = RTStrStr(strFlag.c_str(), "="); 1630 /* skip over everything which doesn't contain '=' */ 1631 if (pcszEqual && pcszEqual != strFlag.c_str()) 1632 { 1633 Utf8Str strKey(strFlag.c_str(), pcszEqual - strFlag.c_str()); 1634 Utf8Str strValue(strFlag.c_str() + (pcszEqual - strFlag.c_str() + 1)); 1635 1636 if (strKey == "UUID") 1637 id = strValue.c_str(); 1638 else if (strKey == "forceOverwrite") 1639 fForceOverwrite = (strValue == "1"); 1640 else if (strKey == "directoryIncludesUUID") 1641 fDirectoryIncludesUUID = (strValue == "1"); 1642 } 1643 1644 if (!pcszComma) 1645 pcszNext += strFlag.length(); 1646 else 1647 pcszNext += strFlag.length() + 1; 1648 } 1649 } 1650 /* Create UUID if none was specified. */ 1651 if (id.isEmpty()) 1652 id.create(); 1653 1572 1654 /* NULL settings file means compose automatically */ 1573 1655 Bstr bstrSettingsFile(aSettingsFile); 1574 1656 if (bstrSettingsFile.isEmpty()) 1575 1657 { 1658 Utf8Str strNewCreateFlags(Utf8StrFmt("UUID=%RTuuid", id.raw())); 1659 if (fDirectoryIncludesUUID) 1660 strNewCreateFlags += ",directoryIncludesUUID=1"; 1661 1576 1662 rc = ComposeMachineFilename(aName, 1577 1663 Bstr(llGroups.front()).raw(), 1664 Bstr(strNewCreateFlags).raw(), 1578 1665 NULL /* aBaseFolder */, 1579 1666 bstrSettingsFile.asOutParam()); … … 1585 1672 rc = machine.createObject(); 1586 1673 if (FAILED(rc)) return rc; 1587 1588 /* Create UUID if an empty one was specified. */1589 Guid id(aId);1590 if (id.isEmpty())1591 id.create();1592 1674 1593 1675 GuestOSType *osType = NULL; … … 1602 1684 osType, 1603 1685 id, 1604 !!forceOverwrite); 1686 fForceOverwrite, 1687 fDirectoryIncludesUUID); 1605 1688 if (SUCCEEDED(rc)) 1606 1689 {
Note:
See TracChangeset
for help on using the changeset viewer.