Changeset 78153 in vbox for trunk/src/VBox/Runtime/common/path/RTPathAbsEx.cpp
- Timestamp:
- Apr 17, 2019 12:30:08 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/common/path/RTPathAbsEx.cpp
r78098 r78153 185 185 { 186 186 Assert(pBaseParsed->cComps > 1); 187 if (iLast >= 0 || (pParsed->fProps & RTPATH_PROP_DIR_SLASH)) 187 if ( iLast >= 0 188 || (pParsed->fProps & RTPATH_PROP_DIR_SLASH) 189 || (fFlags & RTPATHABS_F_ENSURE_TRAILING_SLASH) ) 188 190 pBaseParsed->fProps |= RTPATH_PROP_DIR_SLASH; 189 191 else … … 191 193 } 192 194 195 /* Apply the trailing flash flag to the input path: */ 196 if ( iLast >= 0 197 && (fFlags & RTPATHABS_F_ENSURE_TRAILING_SLASH)) 198 pParsed->fProps |= RTPATH_PROP_DIR_SLASH; 199 193 200 /* 194 201 * Combine the two. RTPathParsedReassemble can handle in place stuff, as … … 207 214 rc = RTPathParsedReassemble(pszPath, pParsed, fFlags & RTPATH_STR_F_STYLE_MASK, 208 215 &pszAbsPath[cchBaseInPlace], *pcbAbsPath - cchBaseInPlace); 209 *pcbAbsPath = cchBaseInPlace + pParsed->cchPath;210 216 if (RT_SUCCESS(rc)) 217 { 218 *pcbAbsPath = cchBaseInPlace + pParsed->cchPath; 211 219 Assert(*pcbAbsPath == strlen(pszAbsPath)); 220 } 221 else 222 *pcbAbsPath = cchBaseInPlace + pParsed->cchPath + 1; 212 223 } 213 224 else … … 219 230 { 220 231 RTPathParsedReassemble(pszPath, pParsed, fFlags & RTPATH_STR_F_STYLE_MASK, pszAbsPath, 0); 221 *pcbAbsPath = pBaseParsed->cchPath + pParsed->cchPath ;232 *pcbAbsPath = pBaseParsed->cchPath + pParsed->cchPath + 1; 222 233 } 223 234 else 224 *pcbAbsPath = pBaseParsed->cchPath ;235 *pcbAbsPath = pBaseParsed->cchPath + 1; 225 236 } 226 237 … … 448 459 i++; 449 460 } 461 462 /* 463 * Before we continue, ensure trailing slash if requested. 464 */ 465 if ( (fFlags & RTPATHABS_F_ENSURE_TRAILING_SLASH) 466 && iLast > 0) 467 pParsed->fProps |= RTPATH_PROP_DIR_SLASH; 450 468 451 469 /* … … 527 545 { 528 546 int rc2 = RTPathParsedReassemble(pszPath, pParsed, fFlags & RTPATH_STR_F_STYLE_MASK, pszAbsPath, 0); 529 Assert(rc2 == VERR_BUFFER_OVERFLOW); RT_NOREF(rc2);547 Assert(rc2 == VERR_BUFFER_OVERFLOW); 530 548 531 549 char *pszTmp = (char *)RTMemTmpAlloc(RTPATH_BIG_MAX); 532 550 if (pszTmp) 533 551 { 534 rc = RTPathGetCurrentDrive(pszTmp, RTPATH_BIG_MAX);535 if (RT_SUCCESS(rc ))552 rc2 = RTPathGetCurrentDrive(pszTmp, RTPATH_BIG_MAX); 553 if (RT_SUCCESS(rc2)) 536 554 *pcbAbsPath = strlen(pszTmp) + pParsed->cchPath + 1; 537 555 else … … 570 588 pParsed->aComps[i].cch = 0; 571 589 } 590 591 if ( (fFlags & RTPATHABS_F_ENSURE_TRAILING_SLASH) 592 && pParsed->cComps > 1) 593 pParsed->fProps |= RTPATH_PROP_DIR_SLASH; 594 572 595 int rc = RTPathParsedReassemble(pszPath, pParsed, fFlags & RTPATH_STR_F_STYLE_MASK, pszAbsPath, *pcbAbsPath); 573 596 *pcbAbsPath = pParsed->cchPath + (rc == VERR_BUFFER_OVERFLOW); … … 589 612 590 613 AssertCompile(RTPATH_STR_F_STYLE_HOST == 0); 591 AssertReturn( RTPATH_STR_F_IS_VALID(fFlags, RTPATHABS_F_STOP_AT_BASE | RTPATHABS_F_STOP_AT_CWD )614 AssertReturn( RTPATH_STR_F_IS_VALID(fFlags, RTPATHABS_F_STOP_AT_BASE | RTPATHABS_F_STOP_AT_CWD | RTPATHABS_F_ENSURE_TRAILING_SLASH) 592 615 && !(fFlags & RTPATH_STR_F_MIDDLE), VERR_INVALID_FLAGS); 593 616 if ((fFlags & RTPATH_STR_F_STYLE_MASK) == RTPATH_STR_F_STYLE_HOST)
Note:
See TracChangeset
for help on using the changeset viewer.