从swift中的库(dylib)添加文件

发布于 2025-02-07 17:15:07 字数 386 浏览 0 评论 0原文

我正在尝试创建一个动态库(Dylib),其中一些文件需要将其发送到Swift中的可执行过程中。为了创建可执行过程,我做到了:

func boot() {
    let task = Process()
    task.launchPath = "/bin/bash"
    task.launchPath = Bundle.main.url(forResource: "boot", withExtension: "", subdirectory: "file/boot")?.path
    task.arguments = ["-f"]
    task.launch()
}

问题是,给予任务后(使用相关命令),如何将文件从动态库发送到该过程?我应该如何构建动态库以允许发送文件?

I'm trying to create a dynamic library (dylib) with some files inside that need to be sent in to an executable process in swift. To create the executable process I did this:

func boot() {
    let task = Process()
    task.launchPath = "/bin/bash"
    task.launchPath = Bundle.main.url(forResource: "boot", withExtension: "", subdirectory: "file/boot")?.path
    task.arguments = ["-f"]
    task.launch()
}

The problem is that after giving the task.arguments (with the related command), how do I send a file from a dynamic library to the process? How should I possibly structure the dynamic library to allow sending a file?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文