diff options
Diffstat (limited to 'CopyMailto')
-rw-r--r-- | CopyMailto/DefaultURLHandler.h | 15 | ||||
-rw-r--r-- | CopyMailto/DefaultURLHandler.m | 28 | ||||
-rw-r--r-- | CopyMailto/main.m | 3 |
3 files changed, 46 insertions, 0 deletions
diff --git a/CopyMailto/DefaultURLHandler.h b/CopyMailto/DefaultURLHandler.h new file mode 100644 index 0000000..7bad3d0 --- /dev/null +++ b/CopyMailto/DefaultURLHandler.h @@ -0,0 +1,15 @@ +// +// DefaultURLHandler.h +// CopyMailto +// +// Created by tw on 9/5/18. +// Copyright © 2018 tw. All rights reserved. +// + +#import <Foundation/Foundation.h> + +@interface DefaultURLHandler : NSObject + ++ (void)saveDefaultURLHandler; + +@end diff --git a/CopyMailto/DefaultURLHandler.m b/CopyMailto/DefaultURLHandler.m new file mode 100644 index 0000000..a8d124f --- /dev/null +++ b/CopyMailto/DefaultURLHandler.m @@ -0,0 +1,28 @@ +// +// DefaultURLHandler.m +// CopyMailto +// +// Created by tw on 9/5/18. +// Copyright © 2018 tw. All rights reserved. +// + +#import "DefaultURLHandler.h" + +@implementation DefaultURLHandler + +//LSSetDefaultHandlerForURLScheme(); ++ (void)saveDefaultURLHandler { + CFStringRef mailto = CFStringCreateWithCString( + kCFAllocatorDefault, + "mailto", + kCFStringEncodingUTF8 + ); + + CFStringRef bundle_identifier = LSCopyDefaultHandlerForURLScheme(mailto); + NSLog(@"%@", bundle_identifier); + + CFRelease(mailto); + CFRelease(bundle_identifier); +} + +@end diff --git a/CopyMailto/main.m b/CopyMailto/main.m index dd3e4a5..8dfe2c1 100644 --- a/CopyMailto/main.m +++ b/CopyMailto/main.m @@ -8,6 +8,9 @@ #import <Cocoa/Cocoa.h> +#import "DefaultURLHandler.h" + int main(int argc, const char * argv[]) { + [DefaultURLHandler saveDefaultURLHandler]; return NSApplicationMain(argc, argv); } |