Changeset 78098 in vbox for trunk/src/VBox/Runtime/common/path/RTPathAbsEx.cpp
- Timestamp:
- Apr 10, 2019 3:51:59 PM (6 years ago)
- File:
-
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/common/path/RTPathAbsEx.cpp
r78097 r78098 1 1 /* $Id$ */ 2 2 /** @file 3 * IPRT - RTPathAbsEx Ex3 * IPRT - RTPathAbsEx and RTPathAbs. 4 4 */ 5 5 … … 44 44 * Ensures that the drive letter is capitalized (prereq: RTPATH_PROP_VOLUME). 45 45 */ 46 DECLINLINE(void) rtPathAbsEx ExUpperCaseDriveLetter(char *pszAbsPath)46 DECLINLINE(void) rtPathAbsExUpperCaseDriveLetter(char *pszAbsPath) 47 47 { 48 48 AssertReturnVoid(pszAbsPath[1] == ':'); … … 58 58 * Uses RTPATHABS_F_STOP_AT_BASE for RTPATHABS_F_STOP_AT_CWD. 59 59 */ 60 static int rtPathAbsEx ExWithCwdOrBaseCommon(const char *pszBase, size_t cchBaseInPlace, PRTPATHPARSED pBaseParsed,61 62 60 static 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) 63 63 { 64 64 AssertReturn(pBaseParsed->cComps > 0, VERR_INVALID_PARAMETER); … … 199 199 { 200 200 if (pBaseParsed->fProps & RTPATH_PROP_VOLUME) 201 rtPathAbsEx ExUpperCaseDriveLetter(pszAbsPath);201 rtPathAbsExUpperCaseDriveLetter(pszAbsPath); 202 202 203 203 cchBaseInPlace = pBaseParsed->cchPath; … … 232 232 * Handles the no-root-path scenario where we do CWD prefixing. 233 233 */ 234 static int rtPathAbsEx ExWithCwd(const char *pszPath, PRTPATHPARSED pParsed, uint32_t fFlags, char *pszAbsPath, size_t *pcbAbsPath)234 static int rtPathAbsExWithCwd(const char *pszPath, PRTPATHPARSED pParsed, uint32_t fFlags, char *pszAbsPath, size_t *pcbAbsPath) 235 235 { 236 236 /* … … 313 313 else 314 314 fFlags &= ~RTPATHABS_F_STOP_AT_BASE; 315 rc = rtPathAbsEx ExWithCwdOrBaseCommon(pszCwd, cchInPlace, pCwdParsed, pszPath, pParsed, fFlags, pszAbsPath, pcbAbsPath);315 rc = rtPathAbsExWithCwdOrBaseCommon(pszCwd, cchInPlace, pCwdParsed, pszPath, pParsed, fFlags, pszAbsPath, pcbAbsPath); 316 316 if (pCwdParsedFree) 317 317 RTMemTmpFree(pCwdParsedFree); … … 325 325 * Handles the no-root-path scenario where we've got a base path. 326 326 */ 327 static int rtPathAbsEx ExWithBase(const char *pszBase, const char *pszPath, PRTPATHPARSED pParsed, uint32_t fFlags,328 327 static int rtPathAbsExWithBase(const char *pszBase, const char *pszPath, PRTPATHPARSED pParsed, uint32_t fFlags, 328 char *pszAbsPath, size_t *pcbAbsPath) 329 329 { 330 330 /* … … 362 362 { 363 363 cchInPlace = *pcbAbsPath; 364 rc = RTPathAbsEx Ex(NULL, pszBase, fFlags, pszAbsPath, &cchInPlace);364 rc = RTPathAbsEx(NULL, pszBase, fFlags, pszAbsPath, &cchInPlace); 365 365 if (RT_SUCCESS(rc)) 366 366 { … … 400 400 * Join paths with the CWD code. 401 401 */ 402 rc = rtPathAbsEx ExWithCwdOrBaseCommon(cchInPlace ? pszAbsPath : pszBase, cchInPlace, pBaseParsed,403 402 rc = rtPathAbsExWithCwdOrBaseCommon(cchInPlace ? pszAbsPath : pszBase, cchInPlace, pBaseParsed, 403 pszPath, pParsed, fFlags, pszAbsPath, pcbAbsPath); 404 404 if (pBaseParsedFree) 405 405 RTMemTmpFree(pBaseParsedFree); … … 411 411 * Handles the RTPATH_PROP_ROOT_SLASH case. 412 412 */ 413 static int rtPathAbsEx ExRootSlash(const char *pszBase, const char *pszPath, PRTPATHPARSED pParsed,414 413 static int rtPathAbsExRootSlash(const char *pszBase, const char *pszPath, PRTPATHPARSED pParsed, 414 uint32_t fFlags, char *pszAbsPath, size_t *pcbAbsPath) 415 415 { 416 416 /* … … 482 482 return VERR_BUFFER_OVERFLOW; 483 483 } 484 rtPathAbsEx ExUpperCaseDriveLetter(pszAbsPath);484 rtPathAbsExUpperCaseDriveLetter(pszAbsPath); 485 485 } 486 486 else if (uBase.Parsed.fProps & RTPATH_PROP_UNC) … … 560 560 * Handles the RTPATH_PROP_ABSOLUTE case. 561 561 */ 562 static int rtPathAbsExExAbsolute(const char *pszPath, PRTPATHPARSED pParsed, 563 uint32_t fFlags, char *pszAbsPath, size_t *pcbAbsPath) 562 static int rtPathAbsExAbsolute(const char *pszPath, PRTPATHPARSED pParsed, uint32_t fFlags, char *pszAbsPath, size_t *pcbAbsPath) 564 563 { 565 564 if (pParsed->fProps & RTPATH_PROP_DOT_REFS) … … 574 573 *pcbAbsPath = pParsed->cchPath + (rc == VERR_BUFFER_OVERFLOW); 575 574 if (RT_SUCCESS(rc) && (pParsed->fProps & RTPATH_PROP_VOLUME)) 576 rtPathAbsEx ExUpperCaseDriveLetter(pszAbsPath);575 rtPathAbsExUpperCaseDriveLetter(pszAbsPath); 577 576 return rc; 578 577 } 579 578 580 579 581 RTDECL(int) RTPathAbsEx Ex(const char *pszBase, const char *pszPath, uint32_t fFlags, char *pszAbsPath, size_t *pcbAbsPath)580 RTDECL(int) RTPathAbsEx(const char *pszBase, const char *pszPath, uint32_t fFlags, char *pszAbsPath, size_t *pcbAbsPath) 582 581 { 583 582 /* … … 624 623 */ 625 624 if (pParsed->fProps & RTPATH_PROP_ABSOLUTE) 626 rc = rtPathAbsEx ExAbsolute(pszPath, pParsed, fFlags, pszAbsPath, pcbAbsPath);625 rc = rtPathAbsExAbsolute(pszPath, pParsed, fFlags, pszAbsPath, pcbAbsPath); 627 626 /* 628 627 * What about relative but with a root slash. 629 628 */ 630 629 else if (pParsed->fProps & RTPATH_PROP_ROOT_SLASH) 631 rc = rtPathAbsEx ExRootSlash(pszBase, pszPath, pParsed, fFlags, pszAbsPath, pcbAbsPath);630 rc = rtPathAbsExRootSlash(pszBase, pszPath, pParsed, fFlags, pszAbsPath, pcbAbsPath); 632 631 /* 633 632 * Not exactly perfect. No root slash. … … 646 645 ) 647 646 ) 648 rc = rtPathAbsEx ExWithBase(pszBase, pszPath, pParsed, fFlags, pszAbsPath, pcbAbsPath);649 else 650 rc = rtPathAbsEx ExWithCwd(pszPath, pParsed, fFlags, pszAbsPath, pcbAbsPath);647 rc = rtPathAbsExWithBase(pszBase, pszPath, pParsed, fFlags, pszAbsPath, pcbAbsPath); 648 else 649 rc = rtPathAbsExWithCwd(pszPath, pParsed, fFlags, pszAbsPath, pcbAbsPath); 651 650 652 651 if (pParsedFree) … … 655 654 } 656 655 656 657 RTDECL(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
Note:
See TracChangeset
for help on using the changeset viewer.