VirtualBox

Changeset 15965 in vbox for trunk/src/VBox/Main


Ignore:
Timestamp:
Jan 15, 2009 1:08:26 PM (16 years ago)
Author:
vboxsync
Message:

Main: Added ISharedFolder::lastAccessError.

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

Legend:

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

    r15945 r15965  
    104104    unconst (mMachine) = aMachine;
    105105
    106     HRESULT rc = protectedInit (aMachine, aThat->mData.mName,
    107                                 aThat->mData.mHostPath, aThat->mData.mWritable);
     106    HRESULT rc = protectedInit (aMachine, aThat->m.name,
     107                                aThat->m.hostPath, aThat->m.writable);
    108108
    109109    /* Confirm a successful initialization when it's the case */
     
    222222    mParent->addDependentChild (this);
    223223
    224     unconst (mData.mName) = aName;
    225     unconst (mData.mHostPath) = hostPath;
    226     mData.mWritable = aWritable;
     224    unconst (m.name) = aName;
     225    unconst (m.hostPath) = hostPath;
     226    m.writable = aWritable;
    227227
    228228    return S_OK;
     
    263263
    264264    /* mName is constant during life time, no need to lock */
    265     mData.mName.cloneTo (aName);
     265    m.name.cloneTo (aName);
    266266
    267267    return S_OK;
     
    276276
    277277    /* mHostPath is constant during life time, no need to lock */
    278     mData.mHostPath.cloneTo (aHostPath);
     278    m.hostPath.cloneTo (aHostPath);
    279279
    280280    return S_OK;
     
    283283STDMETHODIMP SharedFolder::COMGETTER(Accessible) (BOOL *aAccessible)
    284284{
    285     CheckComArgOutPointerValid(aAccessible);
     285    CheckComArgOutPointerValid (aAccessible);
    286286
    287287    AutoCaller autoCaller (this);
     
    291291
    292292    /* check whether the host path exists */
    293     Utf8Str hostPath = Utf8Str (mData.mHostPath);
     293    Utf8Str hostPath = Utf8Str (m.hostPath);
    294294    char hostPathFull [RTPATH_MAX];
    295295    int vrc = RTPathExists (hostPath) ? RTPathReal (hostPath, hostPathFull,
     
    302302    }
    303303
    304     LogWarningThisFunc (("'%s' is not accessible (%Rrc)\n", hostPath.raw(), vrc));
     304    AutoWriteLock alock (this);
     305
     306    m.lastAccessError = BstrFmt (
     307        tr ("'%s' is not accessible (%Rrc)"), hostPath.raw(), vrc);
     308
     309    LogWarningThisFunc (("m.lastAccessError=\"%ls\"\n", m.lastAccessError.raw()));
    305310
    306311    *aAccessible = FALSE;
     
    312317    CheckComArgOutPointerValid(aWritable);
    313318
    314     *aWritable = mData.mWritable;
    315 
    316     return S_OK;
    317 }
     319    *aWritable = m.writable;
     320
     321    return S_OK;
     322}
     323
     324STDMETHODIMP SharedFolder::COMGETTER(LastAccessError) (BSTR *aLastAccessError)
     325{
     326    CheckComArgOutPointerValid (aLastAccessError);
     327
     328    AutoCaller autoCaller (this);
     329    CheckComRCReturnRC (autoCaller.rc());
     330
     331    AutoReadLock alock (this);
     332
     333    m.lastAccessError.cloneTo (aLastAccessError);
     334
     335    return S_OK;
     336}
     337
    318338/* vi: set tabstop=4 shiftwidth=4 expandtab: */
  • trunk/src/VBox/Main/idl/VirtualBox.xidl

    r15849 r15965  
    1104611046  <interface
    1104711047     name="ISharedFolder" extends="$unknown"
    11048      uuid="8b0c5f70-9139-4f97-a421-64d5e9c335d5"
     11048     uuid="ef41869b-ef31-4b30-8e8f-95af35c0e378"
    1104911049     wsmap="struct"
    1105011050     >
     
    1112111121        Whether the folder defined by the host path is writable or
    1112211122        not.
     11123      </desc>
     11124    </attribute>
     11125
     11126    <attribute name="lastAccessError" type="wstring" readonly="yes">
     11127      <desc>
     11128        Text message that represents the result of the last accessibility
     11129        check.
     11130
     11131        Accessibility checks are performed each time the <link to="#accessible"/>
     11132        attribute is read. A @c null string is returned if the last
     11133        accessibility check was successful. A non-null string indicates a
     11134        failure and should normally describe a reason of the failure (for
     11135        example, a file read error).
    1112311136      </desc>
    1112411137    </attribute>
  • trunk/src/VBox/Main/include/SharedFolderImpl.h

    r15051 r15965  
    4343        Data() {}
    4444
    45         const Bstr mName;
    46         const Bstr mHostPath;
    47         BOOL       mWritable;
     45        const Bstr name;
     46        const Bstr hostPath;
     47        BOOL       writable;
     48        Bstr       lastAccessError;
    4849    };
    4950
     
    7879    STDMETHOD(COMGETTER(Accessible)) (BOOL *aAccessible);
    7980    STDMETHOD(COMGETTER(Writable)) (BOOL *aWritable);
     81    STDMETHOD(COMGETTER(LastAccessError)) (BSTR *aLastAccessError);
    8082
    8183    // public methods for internal purposes only
     
    8587    // (ensure there is a caller added before calling them!)
    8688
    87     const Bstr &name() const { return mData.mName; }
    88     const Bstr &hostPath() const { return mData.mHostPath; }
    89     BOOL writable() const { return mData.mWritable; }
     89    const Bstr &name() const { return m.name; }
     90    const Bstr &hostPath() const { return m.hostPath; }
     91    BOOL writable() const { return m.writable; }
    9092
    9193    // for VirtualBoxSupportErrorInfoImpl
     
    106108    const ComObjPtr <VirtualBox, ComWeakRef> mVirtualBox;
    107109
    108     Data mData;
     110    Data m;
    109111};
    110112
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