From 3c17cda93f0fb14fff3ddb5859b64d47f936c4e3 Mon Sep 17 00:00:00 2001 From: Andreas Linde Date: Fri, 3 Jul 2015 15:44:15 +0200 Subject: [PATCH] Remove username in simulator build only Removing username from paths only makes sense in the simulator --- Classes/BITCrashReportTextFormatter.m | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/Classes/BITCrashReportTextFormatter.m b/Classes/BITCrashReportTextFormatter.m index 93b89d6948..f98673fc6a 100644 --- a/Classes/BITCrashReportTextFormatter.m +++ b/Classes/BITCrashReportTextFormatter.m @@ -344,10 +344,12 @@ static const char *findSEL (const char *imageName, NSString *imageUUID, uint64_t processPath = report.processInfo.processPath; /* Remove username from the path */ +#if TARGET_IPHONE_SIMULATOR if ([processPath length] > 0) processPath = [processPath stringByAbbreviatingWithTildeInPath]; if ([processPath length] > 0 && [[processPath substringToIndex:1] isEqualToString:@"~"]) processPath = [NSString stringWithFormat:@"/Users/USER%@", [processPath substringFromIndex:1]]; +#endif } /* Parent Process Name */ @@ -562,11 +564,17 @@ static const char *findSEL (const char *imageName, NSString *imageUUID, uint64_t /* Remove username from the image path */ NSString *imageName = @""; - if (imageInfo.imageName && [imageInfo.imageName length] > 0) + if (imageInfo.imageName && [imageInfo.imageName length] > 0) { +#if TARGET_IPHONE_SIMULATOR imageName = [imageInfo.imageName stringByAbbreviatingWithTildeInPath]; +#else + imageName = imageInfo.imageName; +#endif + } +#if TARGET_IPHONE_SIMULATOR if ([imageName length] > 0 && [[imageName substringToIndex:1] isEqualToString:@"~"]) imageName = [NSString stringWithFormat:@"/Users/USER%@", [imageName substringFromIndex:1]]; - +#endif [text appendFormat: fmt, imageInfo.imageBaseAddress, imageInfo.imageBaseAddress + (MAX(1, imageInfo.imageSize) - 1), // The Apple format uses an inclusive range