From 583b91c98676216a1476f815134e34bd447665a2 Mon Sep 17 00:00:00 2001 From: Claudio Cambra Date: Thu, 12 Jan 2023 16:34:33 +0100 Subject: [PATCH] Add NextcloudFileProviderFilesUtils for file-related utility funcs Signed-off-by: Claudio Cambra --- .../NextcloudFileProviderFilesUtils.swift | 24 +++++++++++++++++++ .../project.pbxproj | 4 ++++ 2 files changed, 28 insertions(+) create mode 100644 shell_integration/MacOSX/NextcloudIntegration/FileProviderExt/NextcloudFileProviderFilesUtils.swift diff --git a/shell_integration/MacOSX/NextcloudIntegration/FileProviderExt/NextcloudFileProviderFilesUtils.swift b/shell_integration/MacOSX/NextcloudIntegration/FileProviderExt/NextcloudFileProviderFilesUtils.swift new file mode 100644 index 000000000..86297128a --- /dev/null +++ b/shell_integration/MacOSX/NextcloudIntegration/FileProviderExt/NextcloudFileProviderFilesUtils.swift @@ -0,0 +1,24 @@ +/* + * Copyright (C) 2023 by Claudio Cambra + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + */ + +import Foundation + +func pathForAppGroupContainer() -> URL? { + guard let appGroupIdentifier = Bundle.main.object(forInfoDictionaryKey: "SocketApiPrefix") as? String else { + print("Could not get container url as missing SocketApiPrefix info in app Info.plist") + return nil + } + + return FileManager.default.containerURL(forSecurityApplicationGroupIdentifier: appGroupIdentifier) +} diff --git a/shell_integration/MacOSX/NextcloudIntegration/NextcloudIntegration.xcodeproj/project.pbxproj b/shell_integration/MacOSX/NextcloudIntegration/NextcloudIntegration.xcodeproj/project.pbxproj index faa602ad6..9e432adbc 100644 --- a/shell_integration/MacOSX/NextcloudIntegration/NextcloudIntegration.xcodeproj/project.pbxproj +++ b/shell_integration/MacOSX/NextcloudIntegration/NextcloudIntegration.xcodeproj/project.pbxproj @@ -30,6 +30,7 @@ 53903D352956184400D0B308 /* LocalSocketClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 539158B127BE891500816F56 /* LocalSocketClient.h */; settings = {ATTRIBUTES = (Public, ); }; }; 53903D37295618A400D0B308 /* LineProcessor.h in Headers */ = {isa = PBXBuildFile; fileRef = 53903D36295618A400D0B308 /* LineProcessor.h */; settings = {ATTRIBUTES = (Public, ); }; }; 539158AC27BE71A900816F56 /* FinderSyncSocketLineProcessor.m in Sources */ = {isa = PBXBuildFile; fileRef = 539158AB27BE71A900816F56 /* FinderSyncSocketLineProcessor.m */; }; + 53D056312970594F00988392 /* NextcloudFileProviderFilesUtils.swift in Sources */ = {isa = PBXBuildFile; fileRef = 53D056302970594F00988392 /* NextcloudFileProviderFilesUtils.swift */; }; C2B573BA1B1CD91E00303B36 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = C2B573B91B1CD91E00303B36 /* main.m */; }; C2B573D21B1CD94B00303B36 /* main.m in Resources */ = {isa = PBXBuildFile; fileRef = C2B573B91B1CD91E00303B36 /* main.m */; }; C2B573DE1B1CD9CE00303B36 /* FinderSync.m in Sources */ = {isa = PBXBuildFile; fileRef = C2B573DD1B1CD9CE00303B36 /* FinderSync.m */; }; @@ -147,6 +148,7 @@ 539158AB27BE71A900816F56 /* FinderSyncSocketLineProcessor.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = FinderSyncSocketLineProcessor.m; sourceTree = ""; }; 539158B127BE891500816F56 /* LocalSocketClient.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LocalSocketClient.h; sourceTree = ""; }; 539158B227BEC98A00816F56 /* LocalSocketClient.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = LocalSocketClient.m; sourceTree = ""; }; + 53D056302970594F00988392 /* NextcloudFileProviderFilesUtils.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NextcloudFileProviderFilesUtils.swift; sourceTree = ""; }; C2B573B11B1CD91E00303B36 /* desktopclient.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = desktopclient.app; sourceTree = BUILT_PRODUCTS_DIR; }; C2B573B51B1CD91E00303B36 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; C2B573B91B1CD91E00303B36 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; @@ -217,6 +219,7 @@ 538E396E27F4765000FA63D5 /* FileProviderItem.swift */, 536EFBF6295CF58100F4CB13 /* FileProviderSocketLineProcessor.swift */, 536EFC35295E3C1100F4CB13 /* NextcloudAccount.swift */, + 53D056302970594F00988392 /* NextcloudFileProviderFilesUtils.swift */, 5307A6F129675346001E0C6A /* NextcloudFilesDatabaseManager.swift */, 5307A6EF29674953001E0C6A /* NextcloudFilesDatabaseTables.swift */, 538E397327F4765000FA63D5 /* FileProviderExt.entitlements */, @@ -530,6 +533,7 @@ 538E396D27F4765000FA63D5 /* FileProviderExtension.swift in Sources */, 536EFBF7295CF58100F4CB13 /* FileProviderSocketLineProcessor.swift in Sources */, 5307A6F229675346001E0C6A /* NextcloudFilesDatabaseManager.swift in Sources */, + 53D056312970594F00988392 /* NextcloudFileProviderFilesUtils.swift in Sources */, 538E396F27F4765000FA63D5 /* FileProviderItem.swift in Sources */, 538E397127F4765000FA63D5 /* FileProviderEnumerator.swift in Sources */, );