VirtualBox

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


Ignore:
Timestamp:
Mar 17, 2020 1:54:12 PM (5 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
136482
Message:

Guest Control: Fixes for IGuestSession::directoryExists() + documentation.

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/idl/VirtualBox.xidl

    r83275 r83309  
    1344913449      </param>
    1345013450      <param name="exists" type="boolean" dir="return">
    13451         <desc>Returns @c true if the directory exists, @c false if not.</desc>
     13451        <desc>Returns @c true if the directory exists, @c false if not, or is not a directory.</desc>
    1345213452      </param>
    1345313453    </method>
  • trunk/src/VBox/Main/src-client/GuestSessionImpl.cpp

    r83295 r83309  
    962962}
    963963
     964/**
     965 * Queries information about a directory on the guest.
     966 *
     967 * @returns VBox status code, or VERR_NOT_A_DIRECTORY if the file system object exists but is not a directory.
     968 * @param   strPath             Path to directory to query information for.
     969 * @param   fFollowSymlinks     Whether to follow symlinks or not.
     970 * @param   objData             Where to store the information returned on success.
     971 * @param   prcGuest            Guest rc, when returning VERR_GSTCTL_GUEST_ERROR.
     972 */
    964973int GuestSession::i_directoryQueryInfo(const Utf8Str &strPath, bool fFollowSymlinks,
    965974                                       GuestFsObjData &objData, int *prcGuest)
     
    33493358HRESULT GuestSession::directoryExists(const com::Utf8Str &aPath, BOOL aFollowSymlinks, BOOL *aExists)
    33503359{
    3351     AutoCaller autoCaller(this); /** @todo r=bird: GuestSessionWrap.cpp does already, doesn't it? */
    3352     if (FAILED(autoCaller.rc())) return autoCaller.rc();
    3353 
    33543360    if (RT_UNLIKELY(aPath.isEmpty()))
    33553361        return setError(E_INVALIDARG, tr("Empty path"));
     
    33633369    GuestFsObjData objData;
    33643370    int rcGuest = VERR_IPE_UNINITIALIZED_STATUS;
    3365     /** @todo r=bird: Please look at i_directoryQueryInfo() and explain why there
    3366      * is an extra FsObjType_Directory check here...
    3367      *
    3368      * Looks a lot like you wanted to replicate the RTDirExists behavior, but when
    3369      * refactoring in i_directoryQueryInfo you lost overview here.   One problem
    3370      * could be that the documention is VirtualBox.xidl does not mention what
    3371      * happens when the path leads to a file system object that isn't a
    3372      * directory.
    3373      *
    3374      * Fix the documention and behaviour so it works like RTDirExists and
    3375      * RTFileExists.  */
     3371
    33763372    int vrc = i_directoryQueryInfo(aPath, aFollowSymlinks != FALSE, objData, &rcGuest);
    33773373    if (RT_SUCCESS(vrc))
    3378         *aExists = objData.mType == FsObjType_Directory;
     3374        *aExists = TRUE;
    33793375    else
    33803376    {
     
    33933389                        break;
    33943390                }
     3391                break;
     3392            }
     3393
     3394            case VERR_NOT_A_DIRECTORY:
     3395            {
     3396                *aExists = FALSE;
    33953397                break;
    33963398            }
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette