Changeset 49039 in vbox for trunk/src/VBox/Main/src-server
- Timestamp:
- Oct 10, 2013 6:27:32 PM (12 years ago)
- svn:sync-xref-src-repo-rev:
- 89816
- Location:
- trunk/src/VBox/Main/src-server
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/src-server/ApplianceImpl.cpp
r48685 r49039 788 788 RTPathStripFilename(tmpDir);; 789 789 char *tmpFile = RTStrDup(RTPathFilename(aName.c_str())); 790 RTPathStrip Ext(tmpFile);791 const char * tmpExt = RTPathExt(aName.c_str());792 RTStrAPrintf(&tmpName, "%s%c%s_%d%s", tmpDir, RTPATH_DELIMITER, tmpFile, i, tmpExt);790 RTPathStripSuffix(tmpFile); 791 const char *pszTmpSuff = RTPathSuffix(aName.c_str()); 792 RTStrAPrintf(&tmpName, "%s%c%s_%d%s", tmpDir, RTPATH_DELIMITER, tmpFile, i, pszTmpSuff); 793 793 RTStrFree(tmpFile); 794 794 RTStrFree(tmpDir); -
trunk/src/VBox/Main/src-server/ApplianceImplExport.cpp
r49038 r49039 352 352 if (FAILED(rc)) throw rc; 353 353 354 Utf8Str strTargetName = Utf8Str(locInfo.strPath).stripPath().strip Ext();354 Utf8Str strTargetName = Utf8Str(locInfo.strPath).stripPath().stripSuffix(); 355 355 strTargetVmdkName = Utf8StrFmt("%s-disk%d.vmdk", strTargetName.c_str(), ++pAppliance->m->cDisks); 356 356 if (strTargetVmdkName.length() > RTTAR_NAME_MAX) … … 388 388 if (FAILED(rc)) throw rc; 389 389 390 Utf8Str strTargetName = Utf8Str(locInfo.strPath).stripPath().strip Ext();390 Utf8Str strTargetName = Utf8Str(locInfo.strPath).stripPath().stripSuffix(); 391 391 strTargetVmdkName = Utf8StrFmt("%s-disk%d.iso", strTargetName.c_str(), ++pAppliance->m->cDisks); 392 392 if (strTargetVmdkName.length() > RTTAR_NAME_MAX) … … 2015 2015 Utf8Str strOvaFile = pTask->locInfo.strPath; 2016 2016 /* Extract the path */ 2017 Utf8Str strOvfFile = strOvaFile.strip Ext().append(".ovf");2017 Utf8Str strOvfFile = strOvaFile.stripSuffix().append(".ovf"); 2018 2018 // Create a memory buffer containing the XML. */ 2019 2019 void *pvBuf = 0; … … 2235 2235 { 2236 2236 // Create & write the manifest file 2237 Utf8Str strMfFilePath = Utf8Str(pTask->locInfo.strPath).strip Ext().append(".mf");2237 Utf8Str strMfFilePath = Utf8Str(pTask->locInfo.strPath).stripSuffix().append(".mf"); 2238 2238 Utf8Str strMfFileName = Utf8Str(strMfFilePath).stripPath(); 2239 2239 pTask->pProgress->SetNextOperation(BstrFmt(tr("Creating manifest file '%s'"), strMfFileName.c_str()).raw(), … … 2371 2371 if (m->fManifest) 2372 2372 { 2373 Utf8Str strMfFile = Utf8Str(strTmpOvf).strip Ext().append(".mf");2373 Utf8Str strMfFile = Utf8Str(strTmpOvf).stripSuffix().append(".mf"); 2374 2374 filesList.push_back(pair<Utf8Str, ULONG>(strMfFile , m->ulWeightForXmlOperation)); /* Use 1% of the total for the manifest file upload */ 2375 2375 } -
trunk/src/VBox/Main/src-server/ApplianceImplImport.cpp
r49038 r49039 641 641 /* Figure out from extension which format the image of disk has. */ 642 642 { 643 char *pszExt = RTPathExt(di.strHref.c_str()); 643 char *pszExt = RTPathSuffix(di.strHref.c_str()); 644 if (pszExt) 645 pszExt++; 644 646 /* Get the system properties. */ 645 647 SystemProperties *pSysProps = mVirtualBox->getSystemProperties(); 646 ComObjPtr<MediumFormat> trgFormat = pSysProps->mediumFormatFromExtension( &pszExt[1]);648 ComObjPtr<MediumFormat> trgFormat = pSysProps->mediumFormatFromExtension(pszExt); 647 649 if (trgFormat.isNull()) 648 650 { … … 955 957 } 956 958 957 Utf8Str strMfFile = Utf8Str(pTask->locInfo.strPath).strip Ext().append(".mf");959 Utf8Str strMfFile = Utf8Str(pTask->locInfo.strPath).stripSuffix().append(".mf"); 958 960 959 961 SHASTORAGE storage; … … 1101 1103 } 1102 1104 1103 Utf8Str extension(RTPathExt(pszFilename));1104 1105 if (! extension.endsWith(".ovf",Utf8Str::CaseInsensitive))1105 Utf8Str suffix(RTPathSuffix(pszFilename)); 1106 1107 if (!suffix.endsWith(".ovf",Utf8Str::CaseInsensitive)) 1106 1108 { 1107 1109 vrc = VERR_FILE_NOT_FOUND; … … 1523 1525 throw setError(E_OUTOFMEMORY); 1524 1526 1525 Utf8Str strMfFile = Utf8Str(pTask->locInfo.strPath).strip Ext().append(".mf");1527 Utf8Str strMfFile = Utf8Str(pTask->locInfo.strPath).stripSuffix().append(".mf"); 1526 1528 1527 1529 SHASTORAGE storage; … … 1573 1575 Utf8Str manifestShaDigest = storage.strDigest; 1574 1576 1575 Utf8Str strCertFile = Utf8Str(pTask->locInfo.strPath).strip Ext().append(".cert");1577 Utf8Str strCertFile = Utf8Str(pTask->locInfo.strPath).stripSuffix().append(".cert"); 1576 1578 if (RTFileExists(strCertFile.c_str())) 1577 1579 { … … 1685 1687 size_t cbMfSize = 0; 1686 1688 size_t cbCertSize = 0; 1687 Utf8Str strMfFile = (Utf8Str(pszFilename)).strip Ext().append(".mf");1688 Utf8Str strCertFile = (Utf8Str(pszFilename)).strip Ext().append(".cert");1689 Utf8Str strMfFile = (Utf8Str(pszFilename)).stripSuffix().append(".mf"); 1690 Utf8Str strCertFile = (Utf8Str(pszFilename)).stripSuffix().append(".cert"); 1689 1691 1690 1692 /* Skip the OVF file, cause this was read in IAppliance::Read already. */ … … 2299 2301 Utf8Str strTempTargetFilename(*strTargetPath); 2300 2302 strTempTargetFilename = strTempTargetFilename.stripPath(); 2301 strTempTargetFilename = strTempTargetFilename.strip Ext();2303 strTempTargetFilename = strTempTargetFilename.stripSuffix(); 2302 2304 Utf8Str vdf = typeOfVirtualDiskFormatFromURI(di.strFormat); 2303 2305 … … 2337 2339 Utf8Str strTrgFormat = "VMDK"; 2338 2340 ULONG lCabs = 0; 2339 char *pszExt = NULL; 2340 2341 if (RTPathHaveExt(strTargetPath->c_str())) 2342 { 2343 pszExt = RTPathExt(strTargetPath->c_str()); 2341 2342 if (RTPathHasSuffix(strTargetPath->c_str())) 2343 { 2344 const char *pszSuff = RTPathSuffix(strTargetPath->c_str()); 2344 2345 /* Figure out which format the user like to have. Default is VMDK. */ 2345 ComObjPtr<MediumFormat> trgFormat = pSysProps->mediumFormatFromExtension(&psz Ext[1]);2346 ComObjPtr<MediumFormat> trgFormat = pSysProps->mediumFormatFromExtension(&pszSuff[1]); 2346 2347 if (trgFormat.isNull()) 2347 2348 throw setError(VBOX_E_NOT_SUPPORTED, -
trunk/src/VBox/Main/src-server/MachineImpl.cpp
r48983 r49039 7911 7911 7912 7912 strFile = mData->m_strConfigFileFull; // path/to/machinesfolder/vmname/vmname.vbox 7913 strFile.strip Ext();// path/to/machinesfolder/vmname/vmname7913 strFile.stripSuffix(); // path/to/machinesfolder/vmname/vmname 7914 7914 strFile.append(".webm"); // path/to/machinesfolder/vmname/vmname.webm 7915 7915 } … … 11974 11974 Utf8Str strConfigFileOnly(mData->m_strConfigFileFull); // path/to/machinesfolder/vmname/vmname.vbox 11975 11975 strConfigFileOnly.stripPath() // vmname.vbox 11976 .strip Ext();// vmname11976 .stripSuffix(); // vmname 11977 11977 /** @todo hack, make somehow use of ComposeMachineFilename */ 11978 11978 if (mUserData->s.fDirectoryIncludesUUID) -
trunk/src/VBox/Main/src-server/MachineImplCloneVM.cpp
r48955 r49039 1134 1134 if (!mt.strBaseName.isEmpty()) 1135 1135 strSrcTest = mt.strBaseName; 1136 strSrcTest.strip Ext();1136 strSrcTest.stripSuffix(); 1137 1137 /* If the old disk name was in {uuid} format we also 1138 1138 * want the new name in this format, but with the … … 1142 1142 * template: "new name-disk1.vdi". */ 1143 1143 if (strSrcTest == strOldVMName) 1144 strNewName = Utf8StrFmt("%s%s", trgMCF.machineUserData.strName.c_str(), RTPath Ext(Utf8Str(bstrSrcName).c_str()));1144 strNewName = Utf8StrFmt("%s%s", trgMCF.machineUserData.strName.c_str(), RTPathSuffix(Utf8Str(bstrSrcName).c_str())); 1145 1145 else if ( strSrcTest.startsWith("{") 1146 1146 && strSrcTest.endsWith("}")) … … 1150 1150 Guid temp_guid(strSrcTest); 1151 1151 if (temp_guid.isValid() && !temp_guid.isZero()) 1152 strNewName = Utf8StrFmt("%s%s", newId.toStringCurly().c_str(), RTPath Ext(strNewName.c_str()));1152 strNewName = Utf8StrFmt("%s%s", newId.toStringCurly().c_str(), RTPathSuffix(strNewName.c_str())); 1153 1153 } 1154 1154 else 1155 strNewName = Utf8StrFmt("%s-disk%d%s", trgMCF.machineUserData.strName.c_str(), ++cDisks, RTPathExt(Utf8Str(bstrSrcName).c_str())); 1155 strNewName = Utf8StrFmt("%s-disk%d%s", trgMCF.machineUserData.strName.c_str(), ++cDisks, 1156 RTPathSuffix(Utf8Str(bstrSrcName).c_str())); 1156 1157 } 1157 1158
Note:
See TracChangeset
for help on using the changeset viewer.