VirtualBox

Changeset 78098 in vbox


Ignore:
Timestamp:
Apr 10, 2019 3:51:59 PM (5 years ago)
Author:
vboxsync
Message:

IPRT,*: Cleaning up RTPathAbsExEx, renaming it to RTPathAbsEx and removing dead code. bugref:9172

Location:
trunk
Files:
1 deleted
10 edited
1 moved

Legend:

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

    r78066 r78098  
    16001600# define RTPathAbsDup                                   RT_MANGLER(RTPathAbsDup)
    16011601# define RTPathAbsEx                                    RT_MANGLER(RTPathAbsEx)
    1602 # define RTPathAbsExEx                                  RT_MANGLER(RTPathAbsExEx)
    16031602# define RTPathAbsExDup                                 RT_MANGLER(RTPathAbsExDup)
    16041603# define RTPathAppDocs                                  RT_MANGLER(RTPathAppDocs)
  • trunk/include/iprt/path.h

    r78051 r78098  
    332332/**
    333333 * Get the absolute path (no symlinks, no . or .. components), assuming the
    334  * given base path as the current directory. The resulting path doesn't have
    335  * to exist.
    336  *
    337  * @returns iprt status code.
    338  * @param   pszBase         The base path to act like a current directory.
    339  *                          When NULL, the actual cwd is used (i.e. the call
    340  *                          is equivalent to RTPathAbs(pszPath, ...).
    341  * @param   pszPath         The path to resolve.
    342  * @param   pszAbsPath      Where to store the absolute path.
    343  * @param   cbAbsPath       Size of the buffer.
    344  *
    345  * @note    Current implementation is buggy and will remove trailing slashes
    346  *          that would normally specify a directory.  Don't depend on this.
    347  */
    348 RTDECL(int) RTPathAbsEx(const char *pszBase, const char *pszPath, char *pszAbsPath, size_t cbAbsPath);
    349 
    350 /**
    351  * Get the absolute path (no symlinks, no . or .. components), assuming the
    352334 * given base path as the current directory.
    353335 *
     
    369351 *                          failures.
    370352 */
    371 RTDECL(int) RTPathAbsExEx(const char *pszBase, const char *pszPath, uint32_t fFlags, char *pszAbsPath, size_t *pcbAbsPath);
     353RTDECL(int) RTPathAbsEx(const char *pszBase, const char *pszPath, uint32_t fFlags, char *pszAbsPath, size_t *pcbAbsPath);
    372354
    373355/** @name RTPATHABS_F_XXX - Flags for RTPathAbsEx.
  • trunk/src/VBox/HostServices/SharedFolders/vbsfpathabs.cpp

    r78090 r78098  
    185185    /* Fallback for the common paths. */
    186186
    187     return RTPathAbsExEx(pszRoot, pszPath, RTPATH_STR_F_STYLE_HOST, pszAbsPath, &cbAbsPath);
     187    return RTPathAbsEx(pszRoot, pszPath, RTPATH_STR_F_STYLE_HOST, pszAbsPath, &cbAbsPath);
    188188}
  • trunk/src/VBox/Main/src-server/MachineImpl.cpp

    r78090 r78098  
    72607260    char szFolder[RTPATH_MAX];
    72617261    size_t cbFolder = sizeof(szFolder);
    7262     int vrc = RTPathAbsExEx(strSettingsDir.c_str(), strPath.c_str(), RTPATH_STR_F_STYLE_HOST, szFolder, &cbFolder);
     7262    int vrc = RTPathAbsEx(strSettingsDir.c_str(), strPath.c_str(), RTPATH_STR_F_STYLE_HOST, szFolder, &cbFolder);
    72637263    if (RT_SUCCESS(vrc))
    72647264        aResult = szFolder;
  • trunk/src/VBox/Main/src-server/VirtualBoxImpl.cpp

    r78090 r78098  
    40144014    char szFolder[RTPATH_MAX];
    40154015    size_t cbFolder = sizeof(szFolder);
    4016     int vrc = RTPathAbsExEx(m->strHomeDir.c_str(),
    4017                             strPath.c_str(),
    4018                             RTPATH_STR_F_STYLE_HOST,
    4019                             szFolder,
    4020                             &cbFolder);
     4016    int vrc = RTPathAbsEx(m->strHomeDir.c_str(),
     4017                          strPath.c_str(),
     4018                          RTPATH_STR_F_STYLE_HOST,
     4019                          szFolder,
     4020                          &cbFolder);
    40214021    if (RT_SUCCESS(vrc))
    40224022        aResult = szFolder;
  • trunk/src/VBox/Runtime/Makefile.kmk

    r78096 r78098  
    512512        common/path/RTPathAbsEx.cpp \
    513513        common/path/RTPathAbsExDup.cpp \
    514         common/path/RTPathAbsExEx.cpp \
    515514        common/path/RTPathAppend.cpp \
    516515        common/path/RTPathAppendEx.cpp \
     
    827826        generic/RTMpGetCurFrequency-generic.cpp \
    828827        generic/RTMpGetMaxFrequency-generic.cpp \
    829         generic/RTPathAbs-generic.cpp \
    830828        generic/RTRandAdvCreateSystemFaster-generic.cpp \
    831829        generic/RTRandAdvCreateSystemTruer-generic.cpp \
     
    917915        generic/RTFileMove-generic.cpp \
    918916        generic/RTLogWriteDebugger-generic.cpp \
    919         generic/RTPathAbs-generic.cpp \
    920917        generic/RTPathGetCurrentOnDrive-generic.cpp \
    921918        generic/RTProcDaemonize-generic.cpp \
     
    10241021        generic/RTFileSetAllocationSize-generic.cpp \
    10251022        generic/RTLogWriteDebugger-generic.cpp \
    1026         generic/RTPathAbs-generic.cpp \
    10271023        generic/RTPathGetCurrentOnDrive-generic.cpp \
    10281024        generic/RTProcDaemonize-generic.cpp \
     
    11061102        generic/RTFileSetAllocationSize-generic.cpp \
    11071103        generic/RTLogWriteDebugger-generic.cpp \
    1108         generic/RTPathAbs-generic.cpp \
    11091104        generic/RTPathGetCurrentOnDrive-generic.cpp \
    11101105        generic/RTProcDaemonize-generic.cpp \
     
    11921187        generic/RTFileSetAllocationSize-generic.cpp \
    11931188        generic/RTLogWriteDebugger-generic.cpp \
    1194         generic/RTPathAbs-generic.cpp \
    11951189        generic/RTPathGetCurrentOnDrive-generic.cpp \
    11961190        generic/RTSemEventMultiWait-2-ex-generic.cpp \
     
    12751269        generic/RTFileMove-generic.cpp \
    12761270        generic/RTLogWriteDebugger-generic.cpp \
    1277         generic/RTPathAbs-generic.cpp \
    12781271        generic/RTSemEventMultiWait-2-ex-generic.cpp \
    12791272        generic/RTSemEventMultiWaitNoResume-2-ex-generic.cpp \
     
    13571350        generic/RTFileMove-generic.cpp \
    13581351        generic/RTLogWriteDebugger-generic.cpp \
    1359         generic/RTPathAbs-generic.cpp \
    13601352        generic/RTPathGetCurrentOnDrive-generic.cpp \
    13611353        generic/RTProcDaemonize-generic.cpp \
     
    14541446        generic/RTFileSetAllocationSize-generic.cpp \
    14551447        generic/RTLogWriteDebugger-generic.cpp \
    1456         generic/RTPathAbs-generic.cpp \
    14571448        generic/RTPathGetCurrentOnDrive-generic.cpp \
    14581449        generic/RTProcDaemonize-generic.cpp \
     
    17071698        common/path/RTPathAbsEx.cpp \
    17081699        common/path/RTPathAbsExDup.cpp \
    1709         common/path/RTPathAbsExEx.cpp \
    17101700        common/path/RTPathAppend.cpp \
    17111701        common/path/RTPathAppendEx.cpp \
     
    18881878        generic/RTFileExists-generic.cpp \
    18891879        generic/RTFileSetAllocationSize-generic.cpp \
    1890         generic/RTPathAbs-generic.cpp \
    18911880        generic/RTRandAdvCreateSystemFaster-generic.cpp \
    18921881        generic/RTRandAdvCreateSystemTruer-generic.cpp \
     
    19571946        generic/RTFileSetAllocationSize-generic.cpp \
    19581947        generic/RTLogWriteDebugger-generic.cpp \
    1959         generic/RTPathAbs-generic.cpp \
    19601948        generic/RTPathGetCurrentOnDrive-generic.cpp \
    19611949        generic/RTRandAdvCreateSystemFaster-generic.cpp \
     
    27202708        common/path/RTPathAbsEx.cpp \
    27212709        common/path/RTPathAbsExDup.cpp \
    2722         common/path/RTPathAbsExEx.cpp \
    27232710        common/path/RTPathAppend.cpp \
    27242711        common/path/RTPathAppendEx.cpp \
  • trunk/src/VBox/Runtime/common/path/RTPathAbsEx.cpp

    r78097 r78098  
    11/* $Id$ */
    22/** @file
    3  * IPRT - RTPathAbsExEx
     3 * IPRT - RTPathAbsEx and RTPathAbs.
    44 */
    55
     
    4444 * Ensures that the drive letter is capitalized (prereq: RTPATH_PROP_VOLUME).
    4545 */
    46 DECLINLINE(void) rtPathAbsExExUpperCaseDriveLetter(char *pszAbsPath)
     46DECLINLINE(void) rtPathAbsExUpperCaseDriveLetter(char *pszAbsPath)
    4747{
    4848    AssertReturnVoid(pszAbsPath[1] == ':');
     
    5858 * Uses RTPATHABS_F_STOP_AT_BASE for RTPATHABS_F_STOP_AT_CWD.
    5959 */
    60 static int rtPathAbsExExWithCwdOrBaseCommon(const char *pszBase, size_t cchBaseInPlace, PRTPATHPARSED pBaseParsed,
    61                                             const char *pszPath, PRTPATHPARSED pParsed, uint32_t fFlags,
    62                                             char *pszAbsPath, size_t *pcbAbsPath)
     60static int rtPathAbsExWithCwdOrBaseCommon(const char *pszBase, size_t cchBaseInPlace, PRTPATHPARSED pBaseParsed,
     61                                          const char *pszPath, PRTPATHPARSED pParsed, uint32_t fFlags,
     62                                          char *pszAbsPath, size_t *pcbAbsPath)
    6363{
    6464    AssertReturn(pBaseParsed->cComps > 0, VERR_INVALID_PARAMETER);
     
    199199    {
    200200        if (pBaseParsed->fProps & RTPATH_PROP_VOLUME)
    201             rtPathAbsExExUpperCaseDriveLetter(pszAbsPath);
     201            rtPathAbsExUpperCaseDriveLetter(pszAbsPath);
    202202
    203203        cchBaseInPlace = pBaseParsed->cchPath;
     
    232232 * Handles the no-root-path scenario where we do CWD prefixing.
    233233 */
    234 static int rtPathAbsExExWithCwd(const char *pszPath, PRTPATHPARSED pParsed, uint32_t fFlags, char *pszAbsPath, size_t *pcbAbsPath)
     234static int rtPathAbsExWithCwd(const char *pszPath, PRTPATHPARSED pParsed, uint32_t fFlags, char *pszAbsPath, size_t *pcbAbsPath)
    235235{
    236236    /*
     
    313313    else
    314314        fFlags &= ~RTPATHABS_F_STOP_AT_BASE;
    315     rc = rtPathAbsExExWithCwdOrBaseCommon(pszCwd, cchInPlace, pCwdParsed, pszPath, pParsed, fFlags, pszAbsPath, pcbAbsPath);
     315    rc = rtPathAbsExWithCwdOrBaseCommon(pszCwd, cchInPlace, pCwdParsed, pszPath, pParsed, fFlags, pszAbsPath, pcbAbsPath);
    316316    if (pCwdParsedFree)
    317317        RTMemTmpFree(pCwdParsedFree);
     
    325325 * Handles the no-root-path scenario where we've got a base path.
    326326 */
    327 static int rtPathAbsExExWithBase(const char *pszBase, const char *pszPath, PRTPATHPARSED pParsed, uint32_t fFlags,
    328                                  char *pszAbsPath, size_t *pcbAbsPath)
     327static int rtPathAbsExWithBase(const char *pszBase, const char *pszPath, PRTPATHPARSED pParsed, uint32_t fFlags,
     328                               char *pszAbsPath, size_t *pcbAbsPath)
    329329{
    330330    /*
     
    362362    {
    363363        cchInPlace = *pcbAbsPath;
    364         rc = RTPathAbsExEx(NULL, pszBase, fFlags, pszAbsPath, &cchInPlace);
     364        rc = RTPathAbsEx(NULL, pszBase, fFlags, pszAbsPath, &cchInPlace);
    365365        if (RT_SUCCESS(rc))
    366366        {
     
    400400     * Join paths with the CWD code.
    401401     */
    402     rc = rtPathAbsExExWithCwdOrBaseCommon(cchInPlace ? pszAbsPath : pszBase, cchInPlace, pBaseParsed,
    403                                           pszPath, pParsed, fFlags, pszAbsPath, pcbAbsPath);
     402    rc = rtPathAbsExWithCwdOrBaseCommon(cchInPlace ? pszAbsPath : pszBase, cchInPlace, pBaseParsed,
     403                                        pszPath, pParsed, fFlags, pszAbsPath, pcbAbsPath);
    404404    if (pBaseParsedFree)
    405405        RTMemTmpFree(pBaseParsedFree);
     
    411411 * Handles the RTPATH_PROP_ROOT_SLASH case.
    412412 */
    413 static int rtPathAbsExExRootSlash(const char *pszBase, const char *pszPath, PRTPATHPARSED pParsed,
    414                                   uint32_t fFlags, char *pszAbsPath, size_t *pcbAbsPath)
     413static int rtPathAbsExRootSlash(const char *pszBase, const char *pszPath, PRTPATHPARSED pParsed,
     414                                uint32_t fFlags, char *pszAbsPath, size_t *pcbAbsPath)
    415415{
    416416    /*
     
    482482                    return VERR_BUFFER_OVERFLOW;
    483483                }
    484                 rtPathAbsExExUpperCaseDriveLetter(pszAbsPath);
     484                rtPathAbsExUpperCaseDriveLetter(pszAbsPath);
    485485            }
    486486            else if (uBase.Parsed.fProps & RTPATH_PROP_UNC)
     
    560560 * Handles the RTPATH_PROP_ABSOLUTE case.
    561561 */
    562 static int rtPathAbsExExAbsolute(const char *pszPath, PRTPATHPARSED pParsed,
    563                                  uint32_t fFlags, char *pszAbsPath, size_t *pcbAbsPath)
     562static int rtPathAbsExAbsolute(const char *pszPath, PRTPATHPARSED pParsed, uint32_t fFlags, char *pszAbsPath, size_t *pcbAbsPath)
    564563{
    565564    if (pParsed->fProps & RTPATH_PROP_DOT_REFS)
     
    574573    *pcbAbsPath = pParsed->cchPath + (rc == VERR_BUFFER_OVERFLOW);
    575574    if (RT_SUCCESS(rc) && (pParsed->fProps & RTPATH_PROP_VOLUME))
    576         rtPathAbsExExUpperCaseDriveLetter(pszAbsPath);
     575        rtPathAbsExUpperCaseDriveLetter(pszAbsPath);
    577576    return rc;
    578577}
    579578
    580579
    581 RTDECL(int) RTPathAbsExEx(const char *pszBase, const char *pszPath, uint32_t fFlags, char *pszAbsPath, size_t *pcbAbsPath)
     580RTDECL(int) RTPathAbsEx(const char *pszBase, const char *pszPath, uint32_t fFlags, char *pszAbsPath, size_t *pcbAbsPath)
    582581{
    583582    /*
     
    624623     */
    625624    if (pParsed->fProps & RTPATH_PROP_ABSOLUTE)
    626         rc = rtPathAbsExExAbsolute(pszPath, pParsed, fFlags, pszAbsPath, pcbAbsPath);
     625        rc = rtPathAbsExAbsolute(pszPath, pParsed, fFlags, pszAbsPath, pcbAbsPath);
    627626    /*
    628627     * What about relative but with a root slash.
    629628     */
    630629    else if (pParsed->fProps & RTPATH_PROP_ROOT_SLASH)
    631         rc = rtPathAbsExExRootSlash(pszBase, pszPath, pParsed, fFlags, pszAbsPath, pcbAbsPath);
     630        rc = rtPathAbsExRootSlash(pszBase, pszPath, pParsed, fFlags, pszAbsPath, pcbAbsPath);
    632631    /*
    633632     * Not exactly perfect.  No root slash.
     
    646645                )
    647646            )
    648         rc = rtPathAbsExExWithBase(pszBase, pszPath, pParsed, fFlags, pszAbsPath, pcbAbsPath);
    649     else
    650         rc = rtPathAbsExExWithCwd(pszPath, pParsed, fFlags, pszAbsPath, pcbAbsPath);
     647        rc = rtPathAbsExWithBase(pszBase, pszPath, pParsed, fFlags, pszAbsPath, pcbAbsPath);
     648    else
     649        rc = rtPathAbsExWithCwd(pszPath, pParsed, fFlags, pszAbsPath, pcbAbsPath);
    651650
    652651    if (pParsedFree)
     
    655654}
    656655
     656
     657RTDECL(int) RTPathAbs(const char *pszPath, char *pszAbsPath, size_t cbAbsPath)
     658{
     659    return RTPathAbsEx(NULL, pszPath, RTPATH_STR_F_STYLE_HOST, pszAbsPath, &cbAbsPath);
     660}
     661
  • trunk/src/VBox/Runtime/common/path/RTPathAbsExDup.cpp

    r78090 r78098  
    5151    char szPath[RTPATH_MAX];
    5252    size_t cbPath = sizeof(szPath);
    53     int rc = RTPathAbsExEx(pszBase, pszPath, RTPATH_STR_F_STYLE_HOST, szPath, &cbPath);
     53    int rc = RTPathAbsEx(pszBase, pszPath, RTPATH_STR_F_STYLE_HOST, szPath, &cbPath);
    5454    if (RT_SUCCESS(rc))
    5555        return RTStrDup(szPath);
     
    6666            if (pszAbsPath)
    6767            {
    68                 rc = RTPathAbsExEx(pszBase, pszPath, RTPATH_STR_F_STYLE_HOST, pszAbsPath, &cbPath);
     68                rc = RTPathAbsEx(pszBase, pszPath, RTPATH_STR_F_STYLE_HOST, pszAbsPath, &cbPath);
    6969                if (RT_SUCCESS(rc))
    7070                    return pszAbsPath;
  • trunk/src/VBox/Runtime/r3/generic/dirrel-r3-generic.cpp

    r78090 r78098  
    8484     * This ASSUMES that pThis->pszPath is an absolute path.
    8585     */
    86     int rc = RTPathAbsExEx(pThis->pszPath, pszRelPath, RTPATH_STR_F_STYLE_HOST, pszPathDst, &cbPathDst);
     86    int rc = RTPathAbsEx(pThis->pszPath, pszRelPath, RTPATH_STR_F_STYLE_HOST, pszPathDst, &cbPathDst);
    8787    if (RT_SUCCESS(rc))
    8888    {
  • trunk/src/VBox/Runtime/r3/nt/dirrel-r3-nt.cpp

    r78090 r78098  
    9595     * This ASSUMES that pThis->pszPath is an absolute path.
    9696     */
    97     int rc = RTPathAbsExEx(pThis->pszPath, pszRelPath, RTPATH_STR_F_STYLE_HOST, pszPathDst, &cbPathDst);
     97    int rc = RTPathAbsEx(pThis->pszPath, pszRelPath, RTPATH_STR_F_STYLE_HOST, pszPathDst, &cbPathDst);
    9898    if (RT_SUCCESS(rc))
    9999    {
  • trunk/src/VBox/Runtime/testcase/tstRTPath.cpp

    r78090 r78098  
    267267
    268268
    269 #if 0
    270     /*
    271      * RTPathAbsEx
     269    /*
     270     * RTPathAbsEx.
    272271     */
    273272    RTTestSub(hTest, "RTPathAbsEx");
    274     static const struct
    275     {
    276         const char *pcszInputBase;
    277         const char *pcszInputPath;
    278         int rc;
    279         const char *pcszOutput;
    280     }
    281     s_aRTPathAbsExTests[] =
    282     {
    283 #if defined (RT_OS_OS2) || defined (RT_OS_WINDOWS)
    284     { NULL, "", VERR_INVALID_PARAMETER, NULL },
    285     { NULL, ".", VINF_SUCCESS, "%p" },
    286     { NULL, "\\", VINF_SUCCESS, "%d\\" },
    287     { NULL, "\\..", VINF_SUCCESS, "%d\\" },
    288     { NULL, "/absolute/..", VINF_SUCCESS, "%d\\" },
    289     { NULL, "/absolute\\\\../..", VINF_SUCCESS, "%d\\" },
    290     { NULL, "/absolute//../path\\", VINF_SUCCESS, "%d\\path" },
    291     { NULL, "/absolute/../../path", VINF_SUCCESS, "%d\\path" },
    292     { NULL, "relative/../dir\\.\\.\\.\\file.txt", VINF_SUCCESS, "%p\\dir\\file.txt" },
    293     { NULL, "\\data\\", VINF_SUCCESS, "%d\\data" },
    294     { "relative_base/dir\\", "\\from_root", VINF_SUCCESS, "%d\\from_root" },
    295     { "relative_base/dir/", "relative_also", VINF_SUCCESS, "%p\\relative_base\\dir\\relative_also" },
    296 #else
    297     { NULL, "", VERR_INVALID_PARAMETER, NULL },
    298     { NULL, ".", VINF_SUCCESS, "%p" },
    299     { NULL, "/", VINF_SUCCESS, "/" },
    300     { NULL, "/..", VINF_SUCCESS, "/" },
    301     { NULL, "/absolute/..", VINF_SUCCESS, "/" },
    302     { NULL, "/absolute\\\\../..", VINF_SUCCESS, "/" },
    303     { NULL, "/absolute//../path/", VINF_SUCCESS, "/path" },
    304     { NULL, "/absolute/../../path", VINF_SUCCESS, "/path" },
    305     { NULL, "relative/../dir/./././file.txt", VINF_SUCCESS, "%p/dir/file.txt" },
    306     { NULL, "relative/../dir\\.\\.\\.\\file.txt", VINF_SUCCESS, "%p/dir\\.\\.\\.\\file.txt" },  /* linux-specific */
    307     { NULL, "/data/", VINF_SUCCESS, "/data" },
    308     { "relative_base/dir/", "/from_root", VINF_SUCCESS, "/from_root" },
    309     { "relative_base/dir/", "relative_also", VINF_SUCCESS, "%p/relative_base/dir/relative_also" },
    310 #endif
    311 #if defined (RT_OS_OS2) || defined (RT_OS_WINDOWS)
    312     { NULL, "C:\\", VINF_SUCCESS, "C:\\" },
    313     { "C:\\", "..", VINF_SUCCESS, "C:\\" },
    314     { "C:\\temp", "..", VINF_SUCCESS, "C:\\" },
    315     { "C:\\VirtualBox/Machines", "..\\VirtualBox.xml", VINF_SUCCESS, "C:\\VirtualBox\\VirtualBox.xml" },
    316     { "C:\\MustDie", "\\from_root/dir/..", VINF_SUCCESS, "C:\\from_root" },
    317     { "C:\\temp", "D:\\data", VINF_SUCCESS, "D:\\data" },
    318     { NULL, "\\\\server\\..\\share", VINF_SUCCESS, "\\\\server\\..\\share" /* kind of strange */ },
    319     { NULL, "\\\\server/", VINF_SUCCESS, "\\\\server\\" },
    320     { NULL, "\\\\", VINF_SUCCESS, "\\\\" },
    321     { NULL, "\\\\\\something", VINF_SUCCESS, "\\\\\\something" /* kind of strange */ },
    322     { "\\\\server\\share_as_base", "/from_root", VINF_SUCCESS, "\\\\server\\from_root" },
    323     { "\\\\just_server", "/from_root", VINF_SUCCESS, "\\\\just_server\\from_root" },
    324     { "\\\\server\\share_as_base", "relative\\data", VINF_SUCCESS, "\\\\server\\share_as_base\\relative\\data" },
    325     { "base", "\\\\?\\UNC\\relative/edwef/..", VINF_SUCCESS, "\\\\?\\UNC\\relative" },
    326     { "\\\\?\\UNC\\base", "/from_root", VERR_INVALID_NAME, NULL },
    327 #else
    328     { "/temp", "..", VINF_SUCCESS, "/" },
    329     { "/VirtualBox/Machines", "../VirtualBox.xml", VINF_SUCCESS, "/VirtualBox/VirtualBox.xml" },
    330     { "/MustDie", "/from_root/dir/..", VINF_SUCCESS, "/from_root" },
    331     { "\\temp", "\\data", VINF_SUCCESS, "%p/\\temp/\\data" },
    332 #endif
    333     };
    334 
    335     for (unsigned i = 0; i < RT_ELEMENTS(s_aRTPathAbsExTests); ++ i)
    336     {
    337         rc = RTPathAbsEx(s_aRTPathAbsExTests[i].pcszInputBase,
    338                          s_aRTPathAbsExTests[i].pcszInputPath,
    339                          szPath, sizeof(szPath));
    340         if (rc != s_aRTPathAbsExTests[i].rc)
    341         {
    342             RTTestIFailed("unexpected result code!\n"
    343                           "   input base: '%s'\n"
    344                           "   input path: '%s'\n"
    345                           "       output: '%s'\n"
    346                           "           rc: %Rrc\n"
    347                           "  expected rc: %Rrc",
    348                           s_aRTPathAbsExTests[i].pcszInputBase,
    349                           s_aRTPathAbsExTests[i].pcszInputPath,
    350                           szPath, rc,
    351                           s_aRTPathAbsExTests[i].rc);
    352             continue;
    353         }
    354 
    355         char szTmp[RTPATH_MAX];
    356         char *pszExpected = NULL;
    357         if (s_aRTPathAbsExTests[i].pcszOutput != NULL)
    358         {
    359             if (s_aRTPathAbsExTests[i].pcszOutput[0] == '%')
    360             {
    361                 RTTESTI_CHECK_RC(rc = RTPathGetCurrent(szTmp, sizeof(szTmp)), VINF_SUCCESS);
    362                 if (RT_FAILURE(rc))
    363                     break;
    364 
    365                 pszExpected = szTmp;
    366 
    367                 if (s_aRTPathAbsExTests[i].pcszOutput[1] == 'p')
    368                 {
    369                     cch = strlen(szTmp);
    370                     if (cch + strlen(s_aRTPathAbsExTests[i].pcszOutput) - 2 <= sizeof(szTmp))
    371                         strcpy(szTmp + cch, s_aRTPathAbsExTests[i].pcszOutput + 2);
    372                 }
    373 #if defined(RT_OS_OS2) || defined(RT_OS_WINDOWS)
    374                 else if (s_aRTPathAbsExTests[i].pcszOutput[1] == 'd')
    375                 {
    376                     if (2 + strlen(s_aRTPathAbsExTests[i].pcszOutput) - 2 <= sizeof(szTmp))
    377                         strcpy(szTmp + 2, s_aRTPathAbsExTests[i].pcszOutput + 2);
    378                 }
    379 #endif
    380             }
    381             else
    382             {
    383                 strcpy(szTmp, s_aRTPathAbsExTests[i].pcszOutput);
    384                 pszExpected = szTmp;
    385             }
    386 
    387             if (strcmp(szPath, pszExpected))
    388             {
    389                 RTTestIFailed("Unexpected result\n"
    390                               "   input base: '%s'\n"
    391                               "   input path: '%s'\n"
    392                               "       output: '%s'\n"
    393                               "     expected: '%s'",
    394                               s_aRTPathAbsExTests[i].pcszInputBase,
    395                               s_aRTPathAbsExTests[i].pcszInputPath,
    396                               szPath,
    397                               s_aRTPathAbsExTests[i].pcszOutput);
    398             }
    399         }
    400     }
    401 #endif
    402 
    403     /*
    404      * RTPathAbsExEx - will replace RTPathAbsEx shortly.
    405      */
    406     RTTestSub(hTest, "RTPathAbsExEx");
    407273    static const struct
    408274    {
     
    477343
    478344        size_t cbAbsPath = sizeof(szPath);
    479         rc = RTPathAbsExEx(s_aRTPathAbsExExTests[i].pcszInputBase,
    480                            s_aRTPathAbsExExTests[i].pcszInputPath,
    481                            s_aRTPathAbsExExTests[i].fFlags,
    482                            szPath, &cbAbsPath);
     345        rc = RTPathAbsEx(s_aRTPathAbsExExTests[i].pcszInputBase,
     346                         s_aRTPathAbsExExTests[i].pcszInputPath,
     347                         s_aRTPathAbsExExTests[i].fFlags,
     348                         szPath, &cbAbsPath);
    483349
    484350        if (RT_FAILURE(s_aRTPathAbsExExTests[i].rc))
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