Skip to content

Commit

Permalink
Fix storage path for processes with no bundleIdentifier
Browse files Browse the repository at this point in the history
  • Loading branch information
nickdowell committed Apr 14, 2021
1 parent ff81bfd commit 18b2ba7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion Bugsnag/Storage/BSGFileLocations.m
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ static BOOL ensureDirExists(NSString *path) {

rootPath = [NSString stringWithFormat:@"%@/com.bugsnag.Bugsnag/%@/%@",
url.path,
[NSBundle mainBundle].bundleIdentifier,
// Processes that don't have an Info.plist have no bundleIdentifier
NSBundle.mainBundle.bundleIdentifier ?: NSProcessInfo.processInfo.processName,
fsVersion];

// If we can't even create the root dir, all is lost, and no file ops can be allowed.
Expand Down
2 changes: 1 addition & 1 deletion Tests/BSGStorageMigratorTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ - (NSString *)getV1RootDir {

return [NSString stringWithFormat:@"%@/com.bugsnag.Bugsnag/%@/v1",
dirs[0],
[NSBundle mainBundle].bundleIdentifier];
NSBundle.mainBundle.bundleIdentifier ?: NSProcessInfo.processInfo.processName];
}

- (NSDictionary *)getDirs {
Expand Down

0 comments on commit 18b2ba7

Please sign in to comment.