VirtualBox

Changeset 67257 in vbox for trunk


Ignore:
Timestamp:
Jun 2, 2017 6:25:33 PM (7 years ago)
Author:
vboxsync
Message:

Main/ApplianceImplExport.cpp: Try get the names consistent when exporting opc-1.0 format.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/src-server/ApplianceImplExport.cpp

    r67254 r67257  
    7575        LocationInfo locInfo;
    7676        i_parseURI(aLocation, locInfo);
     77
     78        Utf8Str strBasename(locInfo.strPath);
     79        strBasename.stripPath().stripSuffix();
     80        if (locInfo.strPath.endsWith(".tar.gz", Utf8Str::CaseSensitive))
     81            strBasename.stripSuffix();
     82
    7783        // create a new virtual system to store in the appliance
    7884        rc = pNewDesc.createObject();
     
    349355                if (FAILED(rc)) throw rc;
    350356
    351                 Utf8Str strName = Utf8Str(locInfo.strPath).stripPath().stripSuffix();
    352                 if (locInfo.strPath.endsWith(".tar.gz", Utf8Str::CaseSensitive))
    353                     strName.stripSuffix();
    354                 strTargetImageName = Utf8StrFmt("%s-disk%.3d.vmdk", strName.c_str(), ++pAppliance->m->cDisks);
     357                strTargetImageName = Utf8StrFmt("%s-disk%.3d.vmdk", strBasename.c_str(), ++pAppliance->m->cDisks);
    355358                if (strTargetImageName.length() > RTTAR_NAME_MAX)
    356359                    throw setError(VBOX_E_NOT_SUPPORTED,
     
    443446                    continue;
    444447
    445                 Utf8Str strName = Utf8Str(locInfo.strPath).stripPath().stripSuffix();
    446                 strTargetImageName = Utf8StrFmt("%s-disk%.3d.iso", strName.c_str(), ++pAppliance->m->cDisks);
     448                strTargetImageName = Utf8StrFmt("%s-disk%.3d.iso", strBasename.c_str(), ++pAppliance->m->cDisks);
    447449                if (strTargetImageName.length() > RTTAR_NAME_MAX)
    448450                    throw setError(VBOX_E_NOT_SUPPORTED,
     
    21672169        if (cTarballs > 0)
    21682170        {
     2171
     2172            strTarballPath.stripFilename().append(RTPATH_SLASH_STR).append(pDiskEntry->strOvf);
    21692173            const char *pszExt = RTPathSuffix(pDiskEntry->strOvf.c_str());
    2170             pszExt = !pszExt || *pszExt != '.' ? ""
    2171                    : pDiskEntry->type == VirtualSystemDescriptionType_HardDiskImage ? "img" : pszExt + 1;
    2172 
    2173             strTarballPath.stripFilename().append(RTPATH_SLASH_STR).append(pDiskEntry->strOvf);
    2174             if (*pszExt)
    2175                 strTarballPath.stripSuffix().append("_").append(pszExt);
     2174            if (pszExt && pszExt[0] == '.' && pszExt[1] != '\0')
     2175            {
     2176                strTarballPath.stripSuffix();
     2177                if (pDiskEntry->type != VirtualSystemDescriptionType_HardDiskImage)
     2178                    strTarballPath.append("_").append(&pszExt[1]);
     2179            }
    21762180            strTarballPath.append(".tar.gz");
    21772181        }
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