- Timestamp:
- Oct 14, 2013 2:13:37 AM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/tools/RTDbgSymCache.cpp
r49053 r49077 665 665 const char * const *papszSuffixes) 666 666 { 667 int rc = RTPathAppend(pszPath, RTPATH_MAX, pszSubDir); 668 if (RT_SUCCESS(rc)) 669 { 670 /* Strip off the bundle suffix. */ 671 const char *pszEnd = &pszPath[cchPath + cchName]; 672 for (unsigned i = 0; papszSuffixes[i]; i++) 673 { 674 Assert(papszSuffixes[i][0] == '.'); 675 size_t cchSuff = strlen(papszSuffixes[i]); 676 if ( cchSuff < cchName 677 && !memcmp(&pszEnd[-(ssize_t)cchSuff], papszSuffixes[i], cchSuff)) 678 { 679 cchName -= cchSuff; 680 break; 681 } 682 } 683 684 /* Add the name. */ 685 rc = RTPathAppendEx(pszPath, RTPATH_MAX, &pszPath[cchPath], cchName); 686 } 687 if (RT_FAILURE(rc)) 688 { 689 pszPath[cchPath + cchName] = '\0'; 690 return RTMsgErrorRc(rc, "Error constructing image bundle path for '%s': %Rrc", pszPath, rc); 691 } 667 /* 668 * Calc the name without the bundle extension. 669 */ 670 size_t const cchOrgName = cchName; 671 const char *pszEnd = &pszPath[cchPath + cchName]; 672 for (unsigned i = 0; papszSuffixes[i]; i++) 673 { 674 Assert(papszSuffixes[i][0] == '.'); 675 size_t cchSuff = strlen(papszSuffixes[i]); 676 if ( cchSuff < cchName 677 && !memcmp(&pszEnd[-(ssize_t)cchSuff], papszSuffixes[i], cchSuff)) 678 { 679 cchName -= cchSuff; 680 break; 681 } 682 } 683 684 /* 685 * Check the immediate directory first, in case it's layed out like 686 * IOPCIFamily.kext. 687 */ 688 int rc = RTPathAppendEx(pszPath, RTPATH_MAX, &pszPath[cchPath], cchName); 689 if (RT_FAILURE(rc) || !RTFileExists(pszPath)) 690 { 691 /* 692 * Not there, ok then try the given subdirectory + name. 693 */ 694 pszPath[cchPath + cchOrgName] = '\0'; 695 rc = RTPathAppend(pszPath, RTPATH_MAX, pszSubDir); 696 if (RT_SUCCESS(rc)) 697 rc = RTPathAppendEx(pszPath, RTPATH_MAX, &pszPath[cchPath], cchName); 698 if (RT_FAILURE(rc)) 699 { 700 pszPath[cchPath + cchOrgName] = '\0'; 701 return RTMsgErrorRc(rc, "Error constructing image bundle path for '%s': %Rrc", pszPath, rc); 702 } 703 } 704 692 705 return VINF_SUCCESS; 693 706 }
Note:
See TracChangeset
for help on using the changeset viewer.