VirtualBox

Changeset 32965 in vbox


Ignore:
Timestamp:
Oct 7, 2010 8:32:29 AM (14 years ago)
Author:
vboxsync
Message:

Main-OVF: fix check of the manifest file existence on import

Location:
trunk/src/VBox/Main
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/ApplianceImplImport.cpp

    r32751 r32965  
    10301030    {
    10311031        mode = ImportFileNoManifest;
    1032         Utf8Str strMfFile = manifestFileName(locInfo.strPath);
    1033         if (!locInfo.strPath.endsWith(".ova", Utf8Str::CaseInsensitive))
    1034         {
    1035             if (RTPathExists(strMfFile.c_str()))
    1036                 mode = ImportFileWithManifest;
    1037         }
    1038         else
    1039         {
    1040             if (RTTarFileExists(locInfo.strPath.c_str(), RTPathFilename(strMfFile.c_str())) == VINF_SUCCESS)
    1041                 mode = ImportFileWithManifest;
    1042         }
     1032        Utf8Str strMfFile = queryManifestFileName(locInfo.strPath);
     1033        if (!strMfFile.isEmpty())
     1034            mode = ImportFileWithManifest;
    10431035    }
    10441036    else
     
    10611053
    10621054    return rc;
     1055}
     1056
     1057Utf8Str Appliance::queryManifestFileName(const Utf8Str& aPath) const
     1058{
     1059    Utf8Str strMfFile = manifestFileName(aPath);
     1060    if (!aPath.endsWith(".ova", Utf8Str::CaseInsensitive))
     1061    {
     1062        if (RTPathExists(strMfFile.c_str()))
     1063            return strMfFile;
     1064
     1065    }
     1066    else
     1067    {
     1068        if (RTTarFileExists(aPath.c_str(), RTPathFilename(strMfFile.c_str())) == VINF_SUCCESS)
     1069            return strMfFile;
     1070    }
     1071    return Utf8Str();
    10631072}
    10641073
     
    10791088    HRESULT rc = S_OK;
    10801089
    1081     Utf8Str strManifestFile = manifestFileName(locInfo.strPath);
     1090    Utf8Str strManifestFile = queryManifestFileName(locInfo.strPath);
    10821091    if (!strManifestFile.isEmpty())
    10831092    {
     
    13921401        /* Add the manifest file to the list of files to extract, but only if
    13931402           one is in the archive. */
    1394         Utf8Str strManifestFile = manifestFileName(strTmpOvf);
    1395         vrc = RTTarFileExists(pTask->locInfo.strPath.c_str(), RTPathFilename(strManifestFile.c_str()));
    1396         if (RT_SUCCESS(vrc))
     1403        Utf8Str strManifestFile = queryManifestFileName(strTmpOvf);
     1404        if (!strManifestFile.isEmpty())
    13971405            filesList.push_back(pair<Utf8Str, ULONG>(strManifestFile.c_str(), 1));
    13981406
     
    24662474        Utf8StrFmt strTmpOvf("%s/%s", pszTmpDir, RTPathFilename(tmpPath.c_str()));
    24672475        /* Now check if there is an manifest file. This is optional. */
    2468         Utf8Str strManifestFile = manifestFileName(strTmpOvf);
     2476        Utf8Str strManifestFile = queryManifestFileName(strTmpOvf);
    24692477        char *pszFilename = RTPathFilename(strManifestFile.c_str());
    24702478        if (!pTask->pProgress.isNull())
  • trunk/src/VBox/Main/include/ApplianceImpl.h

    r32837 r32965  
    133133    void parseBucket(Utf8Str &aPath, Utf8Str &aBucket);
    134134    Utf8Str manifestFileName(const Utf8Str& aPath) const;
     135    Utf8Str queryManifestFileName(const Utf8Str& aPath) const;
    135136
    136137    HRESULT readImpl(const LocationInfo &aLocInfo, ComObjPtr<Progress> &aProgress);
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