Skip to content

LCAppSandboxFileKit is a function to write and access files outside of the macOS application sandbox file! (LCAppSandboxFileKit 是一个用于写入和访问 macOS 应用程序沙盒文件之外的文件的功能的框架 ! )

License

Notifications You must be signed in to change notification settings

DevLiuSir/LCAppSandboxFileKit

Repository files navigation

 LCAppSandboxFileKit is a framework for writing and accessing files outside of the macOS application sandbox file!

中文 | English

How to use

  • Define the path for which authorization is required
let authorizedDirectory = "/"
  • Clear the access permissions of the specified path
LCAppSandboxFileKit.standard.clearAccessForPath(authorizedDirectory) { status in
    if status {
        print("Successfully cleared access to the root directory.")
    } else {
        print("Failed to clear access to the root directory.")
    }
}
  • Check if the directory has access permissions
let isPermiss = LCAppSandboxFileKit.standard.checkAccessForPath(authorizedDirectory)
if isPermiss {
    print("Directory access granted, starting search.")
} else { // No access, request permission
    print("No directory access, requesting permission.")
    LCAppSandboxFileKit.standard.requestAccessForPath(authorizedDirectory, canChooseDirectories: true) { status in
        if status {
            print("Permission granted, proceeding with the process.")
        } else {
            print("Failed to obtain permission.")
        }
    }
}

Design

Installation

CocoaPods

PermissionsKit is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'LCAppSandboxFileKit'

SwiftPackage

Add https://github.com/DevLiuSir/LCAppSandboxFileKit.git in the “Swift Package Manager” tab in Xcode.

License

MIT License

Copyright (c) 2024 Marvin

Author

DevLiuSir

Software Engineer

About

LCAppSandboxFileKit is a function to write and access files outside of the macOS application sandbox file! (LCAppSandboxFileKit 是一个用于写入和访问 macOS 应用程序沙盒文件之外的文件的功能的框架 ! )

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published