Make app groups work on both iOS and macOS

Signed-off-by: Roopesh Chander <roop@roopc.net>
This commit is contained in:
Roopesh Chander
2018-12-28 00:33:31 +05:30
parent 55d6961a2f
commit d7d4355f5e
7 changed files with 30 additions and 5 deletions
+6 -1
View File
@@ -6,7 +6,12 @@ import os.log
extension FileManager {
private static var sharedFolderURL: URL? {
guard let appGroupId = Bundle.main.object(forInfoDictionaryKey: "com.wireguard.ios.app_group_id") as? String else {
#if os(iOS)
let appGroupIdInfoDictionaryKey = "com.wireguard.ios.app_group_id"
#elseif os(OSX)
let appGroupIdInfoDictionaryKey = "com.wireguard.macos.app_group_id"
#endif
guard let appGroupId = Bundle.main.object(forInfoDictionaryKey: appGroupIdInfoDictionaryKey) as? String else {
os_log("Cannot obtain app group ID from bundle", log: OSLog.default, type: .error)
return nil
}