--- /dev/null
+/*
+ * Copyright (C) 2024 by Claudio Cambra <claudio.cambra@nextcloud.com>
+ *
+ * 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 isLibrary(_ path: String) -> Bool {
+ path.hasSuffix(".dylib") || path.hasSuffix(".framework")
+}
let craftLibDir = "\(currentDir)/\(craftTarget)/lib"
let craftLibs = try fm.contentsOfDirectory(atPath: craftLibDir)
for lib in craftLibs {
- let libPath = "\(craftLibDir)/\(lib)"
- guard lib.hasSuffix(".dylib") || lib.hasSuffix(".framework") else { continue }
- try codesign(identity: codeSignIdentity, path: libPath)
+ guard isLibrary(lib) else { continue }
+ try codesign(identity: codeSignIdentity, path: "\(craftLibDir)/\(lib)")
}
let craftPluginsDir = "\(currentDir)/\(craftTarget)/plugins"
}
for case let plugin as String in craftPluginsEnumerator {
- let pluginPath = "\(craftPluginsDir)/\(plugin)"
- guard plugin.hasSuffix(".dylib") || plugin.hasSuffix(".framework") else { continue }
- try codesign(identity: codeSignIdentity, path: pluginPath)
+ guard isLibrary(plugin) else { continue }
+ try codesign(identity: codeSignIdentity, path: "\(craftPluginsDir)/\(plugin)")
}
print("Crafting Nextcloud Desktop Client...")