Skip to content

Commit 2efe2dc

Browse files
committed
Fixed persistent store directory handling when legacyPersistentStoreDirectory is a subpath of persistent store directory and CFBundleDisplayName is not used
1 parent 5e6227b commit 2efe2dc

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

Extensions/CoreDataStorage/XMPPCoreDataStorage.m

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -452,9 +452,11 @@ - (NSString *)persistentStoreDirectory
452452
// Previously the Peristent Story Directory was based on the Bundle Display Name but this can be Localized
453453
// If Peristent Story Directory already exists we will use that
454454
NSString *bundleDisplayName = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleDisplayName"];
455-
NSString *legacyPersistentStoreDirectory = [basePath stringByAppendingPathComponent:bundleDisplayName];
456-
if ([fileManager fileExistsAtPath:legacyPersistentStoreDirectory]) {
457-
return legacyPersistentStoreDirectory;
455+
if (bundleDisplayName) {
456+
NSString *legacyPersistentStoreDirectory = [basePath stringByAppendingPathComponent:bundleDisplayName];
457+
if ([fileManager fileExistsAtPath:legacyPersistentStoreDirectory]) {
458+
return legacyPersistentStoreDirectory;
459+
}
458460
}
459461

460462
// Peristent Story Directory now uses the Bundle Identifier

0 commit comments

Comments
 (0)