VirtualBox

Changeset 33450 in vbox for trunk


Ignore:
Timestamp:
Oct 26, 2010 9:24:32 AM (14 years ago)
Author:
vboxsync
Message:

iprt/path: Added RTPathJoinA.

Location:
trunk
Files:
1 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/iprt/path.h

    r33439 r33450  
    481481
    482482/**
     483 * Same as RTPathJoin, except that the output buffer is allocated.
     484 *
     485 * @returns Buffer containing the joined up path, call RTStrFree to free.  NULL
     486 *          on allocation failure.
     487 * @param   pszPathSrc      The base path to copy into @a pszPathDst before
     488 *                          appending @a pszAppend.
     489 * @param   pszAppend       The partial path to append to pszPathSrc. This can
     490 *                          be NULL, in which case nothing is done.
     491 *
     492 */
     493RTDECL(char *) RTPathJoinA(const char *pszPathSrc, const char *pszAppend);
     494
     495/**
    483496 * Callback for RTPathTraverseList that's called for each element.
    484497 *
  • trunk/src/VBox/Runtime/Makefile.kmk

    r33426 r33450  
    297297        common/path/RTPathHavePath.cpp \
    298298        common/path/RTPathJoin.cpp \
     299        common/path/RTPathJoinA.cpp \
    299300        common/path/RTPathParse.cpp \
    300301        common/path/RTPathRealDup.cpp \
     
    939940        common/path/RTPathHavePath.cpp \
    940941        common/path/RTPathJoin.cpp \
     942        common/path/RTPathJoinA.cpp \
    941943        common/path/RTPathParse.cpp \
    942944        common/path/RTPathRealDup.cpp \
  • trunk/src/VBox/Runtime/common/path/RTPathJoin.cpp

    r28800 r33450  
    11/* $Id$ */
    22/** @file
    3  * IPRT - RTPathJoin
     3 * IPRT - RTPathJoin.
    44 */
    55
     
    4343    AssertPtr(pszPathDst);
    4444    AssertPtr(pszPathSrc);
     45    AssertPtr(pszAppend);
    4546
    4647    /*
  • trunk/src/VBox/Runtime/testcase/tstRTPath.cpp

    r28800 r33450  
    367367
    368368    /*
     369     * RTPathJoinA - reuse the append tests.
     370     */
     371    RTTestSub(hTest, "RTPathJoinA");
     372    for (unsigned i = 0; i < RT_ELEMENTS(s_apszAppendTests); i += 3)
     373    {
     374        const char *pszInput  = s_apszAppendTests[i];
     375        const char *pszAppend = s_apszAppendTests[i + 1];
     376        const char *pszExpect = s_apszAppendTests[i + 2];
     377
     378        char *pszPathDst;
     379        RTTESTI_CHECK(pszPathDst = RTPathJoinA(pszInput, pszAppend));
     380        if (!pszPathDst)
     381            continue;
     382        if (strcmp(pszPathDst, pszExpect))
     383        {
     384            RTTestIFailed("Unexpected result\n"
     385                          "   input: '%s'\n"
     386                          "  append: '%s'\n"
     387                          "  output: '%s'\n"
     388                          "expected: '%s'",
     389                          pszInput, pszAppend, pszPathDst, pszExpect);
     390        }
     391        RTStrFree(pszPathDst);
     392    }
     393
     394    /*
    369395     * RTPathStripTrailingSlash
    370396     */
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