aboutsummaryrefslogtreecommitdiffstats
path: root/WireGuard/Shared
diff options
context:
space:
mode:
authorRoopesh Chander <roop@roopc.net>2018-11-29 15:46:21 +0530
committerRoopesh Chander <roop@roopc.net>2018-11-30 00:36:33 +0530
commit679d63294dad8abdb68b9bcd270746912ec4e7cf (patch)
tree1de73899aa8165536863b164f3b8e30f9ccfe200 /WireGuard/Shared
parentInfo.plist: Add app group id for accessing from both the app and the network extension (diff)
downloadwireguard-apple-679d63294dad8abdb68b9bcd270746912ec4e7cf.tar.xz
wireguard-apple-679d63294dad8abdb68b9bcd270746912ec4e7cf.zip
NE: Write log to file
Signed-off-by: Roopesh Chander <roop@roopc.net>
Diffstat (limited to 'WireGuard/Shared')
-rw-r--r--WireGuard/Shared/FileManager+Extension.swift19
1 files changed, 19 insertions, 0 deletions
diff --git a/WireGuard/Shared/FileManager+Extension.swift b/WireGuard/Shared/FileManager+Extension.swift
new file mode 100644
index 0000000..7b25ffb
--- /dev/null
+++ b/WireGuard/Shared/FileManager+Extension.swift
@@ -0,0 +1,19 @@
+// SPDX-License-Identifier: MIT
+// Copyright © 2018 WireGuard LLC. All Rights Reserved.
+
+import Foundation
+import os.log
+
+extension FileManager {
+ static var networkExtensionLogFileURL: URL? {
+ guard let appGroupId = Bundle.main.object(forInfoDictionaryKey: "com.wireguard.ios.app_group_id") as? String else {
+ os_log("Can't obtain app group id from bundle", log: OSLog.default, type: .error)
+ return nil
+ }
+ guard let sharedFolderURL = FileManager.default.containerURL(forSecurityApplicationGroupIdentifier: appGroupId) else {
+ os_log("Can't obtain shared folder URL", log: OSLog.default, type: .error)
+ return nil
+ }
+ return sharedFolderURL.appendingPathComponent("lastActivatedTunnelLog.txt")
+ }
+}