Changeset 37905 in vbox for trunk/src/VBox/Main/src-server
- Timestamp:
- Jul 12, 2011 3:37:33 PM (14 years ago)
- svn:sync-xref-src-repo-rev:
- 72808
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/src-server/MachineImplCloneVM.cpp
r37900 r37905 528 528 trgMCF.fCurrentStateModified = true; 529 529 /* Set the new name. */ 530 const Utf8Str strOldVMName = trgMCF.machineUserData.strName; 530 531 trgMCF.machineUserData.strName = d->pTrgMachine->mUserData->s.strName; 531 532 trgMCF.uuid = d->pTrgMachine->mData->mUuid; … … 596 597 } 597 598 598 /* If the old disk name was in {uuid} format we also want599 * the new name in this format, but with the updated id of600 * course. For all other disks we rename them with this601 * template: "new name-disk1.vdi". */602 599 Guid newId; 603 600 newId.create(); … … 605 602 if (!fKeepDiskNames) 606 603 { 607 strNewName = Utf8StrFmt("%s-disk%d%s", trgMCF.machineUserData.strName.c_str(), ++cDisks, RTPathExt(Utf8Str(bstrSrcName).c_str())); 604 /* If the old disk name was in {uuid} format we also 605 * want the new name in this format, but with the 606 * updated id of course. If the old disk was called 607 * like the VM name, we change it to the new VM name. 608 * For all other disks we rename them with this 609 * template: "new name-disk1.vdi". */ 608 610 Utf8Str strSrcTest = Utf8Str(bstrSrcName).stripExt(); 611 if (strSrcTest == strOldVMName) 612 strNewName = Utf8StrFmt("%s%s", trgMCF.machineUserData.strName.c_str(), RTPathExt(Utf8Str(bstrSrcName).c_str())); 613 else 609 614 if (strSrcTest.startsWith("{") && 610 615 strSrcTest.endsWith("}")) … … 612 617 strSrcTest = strSrcTest.substr(1, strSrcTest.length() - 2); 613 618 if (isValidGuid(strSrcTest)) 614 {615 619 strNewName = Utf8StrFmt("%s%s", newId.toStringCurly().c_str(), RTPathExt(strNewName.c_str())); 616 --cDisks;617 }618 620 } 621 else 622 strNewName = Utf8StrFmt("%s-disk%d%s", trgMCF.machineUserData.strName.c_str(), ++cDisks, RTPathExt(Utf8Str(bstrSrcName).c_str())); 619 623 } 620 624
Note:
See TracChangeset
for help on using the changeset viewer.