Browse Source

IOSAD-186 fixes: session always NULL due to system.db not found

IOS-2651
Andreas Buff 1 year ago
parent
commit
a1a2126cb2
1 changed files with 5 additions and 11 deletions
  1. +5
    -11
      pEpObjCAdapter/PEPObjCAdapter.m

+ 5
- 11
pEpObjCAdapter/PEPObjCAdapter.m View File

@ -244,26 +244,21 @@ static id<PEPPassphraseProviderProtocol> s_passphraseProvider = nil;
return nil;
}
+ (void)copyAssetsIntoDocumentsDirectory:(NSBundle *)rootBundle
bundleName:(NSString *)bundleName
fileName:(NSString *)fileName {
+ (void)copyAssetsIntoDocumentsDirectory:(NSBundle *)srcBundle
fileName:(NSString *)fileName {
#ifdef IS_IOS_BUILD //BUFF: DIRK: //!!!:
NSString *systemDir = [NSString stringWithUTF8String:perMachineDirectory];
if(!(systemDir && bundleName && fileName))
if(!(srcBundle && systemDir && fileName)) {
return;
}
// Check if the database file exists in the documents directory.
NSString *destinationPath = [systemDir stringByAppendingPathComponent:fileName];
if (![[NSFileManager defaultManager] fileExistsAtPath:destinationPath]) {
// The file does not exist in the documents directory, so copy it from bundle now.
NSBundle *bundleObj = [NSBundle bundleWithPath:
[[rootBundle resourcePath]
stringByAppendingPathComponent: bundleName]];
if (!bundleObj)
return;
NSString *sourcePath =[[bundleObj resourcePath] stringByAppendingPathComponent: fileName];
NSString *sourcePath =[[srcBundle resourcePath] stringByAppendingPathComponent: fileName];
NSError *error;
[[NSFileManager defaultManager]
@ -281,7 +276,6 @@ static id<PEPPassphraseProviderProtocol> s_passphraseProvider = nil;
// iOS to force us to think about macOS
#if TARGET_OS_IPHONE
[PEPObjCAdapter copyAssetsIntoDocumentsDirectory:rootBundle
bundleName:@"pEpTrustWords.bundle"
fileName:@"system.db"];
#endif


Loading…
Cancel
Save