VirtualBox

Changeset 33487 in vbox for trunk/src


Ignore:
Timestamp:
Oct 27, 2010 9:23:42 AM (14 years ago)
Author:
vboxsync
Message:

a couple of lines more.

File:
1 edited

Legend:

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

    r33477 r33487  
    2323
    2424#include <iprt/dir.h>
     25#include <iprt/file.h>
    2526#include <iprt/ldr.h>
    2627#include <iprt/param.h>
     
    378379STDMETHODIMP ExtPackManager::Install(IN_BSTR a_bstrTarball, BSTR *a_pbstrName)
    379380{
    380     NOREF(a_bstrTarball); NOREF(a_pbstrName);
    381     return E_NOTIMPL;
     381    CheckComArgNotNull(a_bstrTarball);
     382    CheckComArgOutPointerValid(a_pbstrName);
     383    Utf8Str strTarball(a_bstrTarball);
     384
     385    /*
     386     * Check that the file exists and that we can access it.
     387     */
     388    HRESULT hrc;
     389    if (RTFileExists(strTarball.c_str()))
     390    {
     391        RTFILE hFile;
     392        int vrc = RTFileOpen(&hFile, strTarball.c_str(), RTFILE_O_READ | RTFILE_O_DENY_WRITE | RTFILE_O_OPEN);
     393        if (RT_SUCCESS(vrc))
     394        {
     395            /*
     396             * .
     397             */
     398
     399
     400            RTFileClose(hFile);
     401        }
     402        else
     403            hrc = setError(E_FAIL, tr("Failed to open '%s' (%Rrc)"), strTarball.c_str(), vrc);
     404    }
     405    else if (RTPathExists(strTarball.c_str()))
     406        hrc = setError(E_FAIL, tr("'%s' is not a regular file"), strTarball.c_str());
     407    else
     408        hrc = setError(E_FAIL, tr("File '%s' was inaccessible or not found"), strTarball.c_str());
     409    return hrc;
    382410}
    383411
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