VirtualBox

Changeset 67133 in vbox for trunk/src/VBox


Ignore:
Timestamp:
May 29, 2017 5:51:35 PM (8 years ago)
Author:
vboxsync
Message:

IPRT: Added RTVfsChainQueryFinalPath.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/common/vfs/vfschain.cpp

    r66762 r67133  
    14911491
    14921492
     1493RTDECL(int) RTVfsChainQueryFinalPath(const char *pszSpec, char **ppszFinalPath, uint32_t *poffError)
     1494{
     1495    /* Make sure we've got an error info variable. */
     1496    uint32_t offErrorIgn;
     1497    if (!poffError)
     1498        poffError = &offErrorIgn;
     1499    *poffError = 0;
     1500
     1501    /*
     1502     * If not chain specifier, just duplicate the input and return.
     1503     */
     1504    if (strncmp(pszSpec, RTVFSCHAIN_SPEC_PREFIX, sizeof(RTVFSCHAIN_SPEC_PREFIX) - 1) != 0)
     1505        return RTStrDupEx(ppszFinalPath, pszSpec);
     1506
     1507    /*
     1508     * Parse it and check out the last element.
     1509     */
     1510    PRTVFSCHAINSPEC pSpec = NULL;
     1511    int rc = RTVfsChainSpecParse(pszSpec,  0 /*fFlags*/, RTVFSOBJTYPE_BASE, &pSpec, poffError);
     1512    if (RT_SUCCESS(rc))
     1513    {
     1514        PCRTVFSCHAINELEMSPEC pLast = &pSpec->paElements[pSpec->cElements - 1];
     1515        if (pLast->pszProvider == NULL)
     1516            rc = RTStrDupEx(ppszFinalPath, pLast->paArgs[0].psz);
     1517        else
     1518        {
     1519            rc = VERR_VFS_CHAIN_NOT_PATH_ONLY;
     1520            *poffError = pLast->offSpec;
     1521        }
     1522        RTVfsChainSpecFree(pSpec);
     1523    }
     1524    return rc;
     1525}
     1526
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