IOSAD-150 Give pEp its own directory. IOSAD-150
authorDirk Zimmermann <dz@pep.security>
Wed, 09 Oct 2019 09:30:57 +0200
branchIOSAD-150
changeset 13069c7c1c67b789
parent 1305 af8a3f033c00
child 1307 46ec48840f8e
IOSAD-150 Give pEp its own directory.
pEpObjCAdapter/PEPObjCAdapter.m
     1.1 --- a/pEpObjCAdapter/PEPObjCAdapter.m	Wed Oct 09 09:30:57 2019 +0200
     1.2 +++ b/pEpObjCAdapter/PEPObjCAdapter.m	Wed Oct 09 09:30:57 2019 +0200
     1.3 @@ -91,7 +91,18 @@
     1.4      NSFileManager *fm = [NSFileManager defaultManager];
     1.5      NSURL *containerUrl = [fm containerURLForSecurityApplicationGroupIdentifier:appGroupId];
     1.6      NSLog(@"containerUrl '%@'", containerUrl);
     1.7 -    return containerUrl;
     1.8 +
     1.9 +    NSURL *dirPath = [containerUrl URLByAppendingPathComponent:@"pEp_home"];
    1.10 +
    1.11 +    // If the directory does not exist, this method creates it.
    1.12 +    // This method is only available in OS X v10.7 and iOS 5.0 or later.
    1.13 +    NSError *theError = nil;
    1.14 +    if (![fm createDirectoryAtURL:dirPath withIntermediateDirectories:YES
    1.15 +                       attributes:nil error:&theError]) {
    1.16 +        NSLog(@"ERROR: Could not create pEp home directory, directly writing to app container instead.");
    1.17 +    }
    1.18 +
    1.19 +    return dirPath;
    1.20  }
    1.21  
    1.22  /**