Use pathForAppGroupContainer func in FileProviderExtension
authorClaudio Cambra <claudio.cambra@nextcloud.com>
Thu, 12 Jan 2023 15:38:57 +0000 (16:38 +0100)
committerClaudio Cambra <claudio.cambra@nextcloud.com>
Fri, 12 May 2023 05:21:11 +0000 (13:21 +0800)
Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
shell_integration/MacOSX/NextcloudIntegration/FileProviderExt/FileProviderExtension.swift

index 98116c0bd50039c2c4c7a78c09b7df9fd8b6bd3e..209c626f49477fd1875ef5a57971049fc5841c48 100644 (file)
@@ -23,16 +23,15 @@ class FileProviderExtension: NSObject, NSFileProviderReplicatedExtension {
     let appGroupIdentifier: String? = Bundle.main.object(forInfoDictionaryKey: "SocketApiPrefix") as? String
     var ncAccount: NextcloudAccount?
     lazy var socketClient: LocalSocketClient? = {
-        guard let fileProviderSocketApiPrefix = appGroupIdentifier else {
-            NSLog("Could not start file provider socket client properly as SocketApiPrefix is missing")
+        guard let containerUrl = pathForAppGroupContainer() else {
+            NSLog("Could not start file provider socket client properly as could not get container url")
             return nil;
         }
 
-        let containerUrl = FileManager.default.containerURL(forSecurityApplicationGroupIdentifier: fileProviderSocketApiPrefix)
-        let socketPath = containerUrl?.appendingPathComponent(".fileprovidersocket", conformingTo: .archive)
+        let socketPath = containerUrl.appendingPathComponent(".fileprovidersocket", conformingTo: .archive)
         let lineProcessor = FileProviderSocketLineProcessor(delegate: self)
 
-        return LocalSocketClient(socketPath: socketPath?.path, lineProcessor: lineProcessor)
+        return LocalSocketClient(socketPath: socketPath.path, lineProcessor: lineProcessor)
     }()
 
     let urlSessionIdentifier: String = "com.nextcloud.session.upload.fileproviderext"