diff --git a/Squirrel.xcodeproj/project.pbxproj b/Squirrel.xcodeproj/project.pbxproj index 08e633795..15e8a6ac9 100644 --- a/Squirrel.xcodeproj/project.pbxproj +++ b/Squirrel.xcodeproj/project.pbxproj @@ -590,6 +590,7 @@ CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; + CODE_SIGN_ENTITLEMENTS = resources/Squirrel.entitlements; COMBINE_HIDPI_IMAGES = YES; COPY_PHASE_STRIP = NO; CURRENT_PROJECT_VERSION = 1.0.0; @@ -645,6 +646,7 @@ CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; + CODE_SIGN_ENTITLEMENTS = resources/Squirrel.entitlements; COMBINE_HIDPI_IMAGES = YES; CURRENT_PROJECT_VERSION = 1.0.0; DEAD_CODE_STRIPPING = YES; diff --git a/resources/Squirrel.entitlements b/resources/Squirrel.entitlements index a69efddb0..b86f7f3d5 100644 --- a/resources/Squirrel.entitlements +++ b/resources/Squirrel.entitlements @@ -2,32 +2,11 @@ - com.apple.security.temporary-exception.shared-preference.read-write - - com.apple.security.temporary-exception.files.absolute-path.read-write - - /Library/Input Methods/Squirrel.app - - com.apple.security.temporary-exception.files.absolute-path.read-only - - /usr/bin/say - - com.apple.security.temporary-exception.files.home-relative-path.read-write - - /Library/Rime/ - - com.apple.security.files.bookmarks.app-scope + com.apple.security.cs.disable-library-validation com.apple.security.app-sandbox - - com.apple.security.files.user-selected.read-write - + com.apple.security.network.client - com.apple.security.temporary-exception.mach-lookup.global-name - - $(PRODUCT_BUNDLE_IDENTIFIER)-spks - $(PRODUCT_BUNDLE_IDENTIFIER)-spki - diff --git a/sources/Main.swift b/sources/Main.swift index 4e019f144..22dfe6291 100644 --- a/sources/Main.swift +++ b/sources/Main.swift @@ -125,32 +125,11 @@ struct SquirrelApp { // finally run everything app.run() print("Squirrel is quitting...") - cleanupOldFiles(olderThan: 5) rimeAPI.finalize() } return } - static func cleanupOldFiles(olderThan days: Int) { - let fileManager = FileManager.default - let currentDate = Date() - let calendar = Calendar.current - - do { - let fileURLs = try fileManager.contentsOfDirectory(at: fileManager.temporaryDirectory, includingPropertiesForKeys: [.creationDateKey], options: .skipsHiddenFiles) - for fileURL in fileURLs { - if let creationDate = try fileURL.resourceValues(forKeys: [.creationDateKey]).creationDate { - if let daysDifference = calendar.dateComponents([.day], from: creationDate, to: currentDate).day, daysDifference > days { - try fileManager.removeItem(at: fileURL) - // print("Deleted: \(fileURL.path)") - } - } - } - } catch { - print("Error: \(error.localizedDescription)") - } - } - static let helpDoc = """ Supported arguments: Perform actions: