IOS-1784 DEBUG: Dumping all known directories, by kind. IOS-1784
authorDirk Zimmermann <dz@pep.security>
Fri, 06 Sep 2019 10:35:55 +0200
branchIOS-1784
changeset 122263ad79defb64
parent 1221 54e304e33227
child 1223 023b20652160
IOS-1784 DEBUG: Dumping all known directories, by kind.
pEpObjCAdapter/PEPObjCAdapter.m
     1.1 --- a/pEpObjCAdapter/PEPObjCAdapter.m	Thu Sep 05 14:23:25 2019 +0200
     1.2 +++ b/pEpObjCAdapter/PEPObjCAdapter.m	Fri Sep 06 10:35:55 2019 +0200
     1.3 @@ -68,8 +68,50 @@
     1.4      return s_homeURL;
     1.5  }
     1.6  
     1.7 ++ (void)dumpDirectories
     1.8 +{
     1.9 +    NSDictionary *constants =
    1.10 +    @{
    1.11 +      [NSNumber numberWithInteger:NSApplicationDirectory]: @"NSApplicationDirectory",
    1.12 +      [NSNumber numberWithInteger:NSDemoApplicationDirectory]: @"NSDemoApplicationDirectory",
    1.13 +      [NSNumber numberWithInteger:NSDeveloperApplicationDirectory]: @"NSDeveloperApplicationDirectory",
    1.14 +      [NSNumber numberWithInteger:NSAdminApplicationDirectory]: @"NSAdminApplicationDirectory",
    1.15 +      [NSNumber numberWithInteger:NSLibraryDirectory]: @"NSLibraryDirectory",
    1.16 +      [NSNumber numberWithInteger:NSDeveloperDirectory]: @"NSDeveloperDirectory",
    1.17 +      [NSNumber numberWithInteger:NSUserDirectory]: @"NSUserDirectory",
    1.18 +      [NSNumber numberWithInteger:NSDocumentationDirectory]: @"NSDocumentationDirectory",
    1.19 +      [NSNumber numberWithInteger:NSDocumentDirectory]: @"NSDocumentDirectory",
    1.20 +      [NSNumber numberWithInteger:NSCoreServiceDirectory]: @"NSCoreServiceDirectory",
    1.21 +      [NSNumber numberWithInteger:NSAutosavedInformationDirectory]: @"NSAutosavedInformationDirectory",
    1.22 +      [NSNumber numberWithInteger:NSDesktopDirectory]: @"NSDesktopDirectory",
    1.23 +      [NSNumber numberWithInteger:NSCachesDirectory]: @"NSCachesDirectory",
    1.24 +      [NSNumber numberWithInteger:NSApplicationSupportDirectory]: @"NSApplicationSupportDirectory",
    1.25 +      [NSNumber numberWithInteger:NSDownloadsDirectory]: @"NSDownloadsDirectory",
    1.26 +      [NSNumber numberWithInteger:NSInputMethodsDirectory]: @"NSInputMethodsDirectory",
    1.27 +      [NSNumber numberWithInteger:NSMoviesDirectory]: @"NSMoviesDirectory",
    1.28 +      [NSNumber numberWithInteger:NSMusicDirectory]: @"NSMusicDirectory",
    1.29 +      [NSNumber numberWithInteger:NSPicturesDirectory]: @"NSPicturesDirectory",
    1.30 +      [NSNumber numberWithInteger:NSPrinterDescriptionDirectory]: @"NSPrinterDescriptionDirectory",
    1.31 +      [NSNumber numberWithInteger:NSSharedPublicDirectory]: @"NSSharedPublicDirectory",
    1.32 +      [NSNumber numberWithInteger:NSPreferencePanesDirectory]: @"NSPreferencePanesDirectory",
    1.33 +      [NSNumber numberWithInteger:NSItemReplacementDirectory]: @"NSItemReplacementDirectory",
    1.34 +      [NSNumber numberWithInteger:NSAllApplicationsDirectory]: @"NSAllApplicationsDirectory",
    1.35 +      [NSNumber numberWithInteger:NSAllLibrariesDirectory]: @"NSAllLibrariesDirectory",
    1.36 +      };
    1.37 +
    1.38 +    NSFileManager *fm = [NSFileManager defaultManager];
    1.39 +
    1.40 +    [constants enumerateKeysAndObjectsUsingBlock:^(NSNumber *key, NSString *value, BOOL* stop) {
    1.41 +        NSArray *dirs = [fm URLsForDirectory:[key integerValue]
    1.42 +                                   inDomains:NSUserDomainMask];
    1.43 +        NSLog(@"%@ => %@", value, dirs);
    1.44 +    }];
    1.45 +}
    1.46 +
    1.47  + (NSURL *)createApplicationDirectory
    1.48  {
    1.49 +    [self dumpDirectories];
    1.50 +
    1.51      NSString *bundleID = [[NSBundle mainBundle] bundleIdentifier];
    1.52      if (!bundleID) {
    1.53          // This can happen in unit tests