简体   繁体   English

在沙盒(电子)应用程序中执行qlmanage不起作用

[英]execute qlmanage in sandboxed (electron) App doesn't work

My setup is an electron app on macOs. 我的设置是macOS上的电子应用程序。 I am using exec-sh to run $ qlmanage ... to generate thumbnails. 我正在使用exec-sh运行$ qlmanage ...生成缩略图。 It all works fine, except when I sign the app and set the sandbox entitlements to true. 一切正常,除非我对应用程序进行了签名并将沙盒权利设置为true。 I tried everything, but nothing works: 我尝试了一切,但没有任何效果:

  • added com.apple.security.files.user-selected.executable to my plist 将com.apple.security.files.user-selected.executable添加到我的plist
  • copied the Image.qlgenerator Plugin into my app (in build process) and force the command to use this generator 将Image.qlgenerator插件复制到我的应用程序中(在构建过程中),并强制命令使用此生成器
  • set folder permissions (but other commands like mkdir or create/write files are working) 设置文件夹权限(但是其他命令(如mkdir或创建/写入文件)正在运行)
  • all combinations of qlmanage options qlmanage选项的所有组合

If I set com.apple.security.app-sandbox to false it works. 如果我将com.apple.security.app-sandbox设置为false则可以使用。 The error log is pretty useless to me: 错误日志对我来说毫无用处:

Error: Shell command exit with non zero code: 255

I am pretty unsure if it is even possible to run $ qlmanage inside a sandboxed app... 我非常不确定是否有可能在沙盒应用程序中运行$ qlmanage ...

To get a Quicklook image from a file, you'd rather use 要从文件中获取Quicklook图像,您宁愿使用

CGImageRef QLThumbnailImageCreate(CFAllocatorRef allocator, CFURLRef url, CGSize maxThumbnailSize, CFDictionaryRef options);

This will return an CGImage that you may use as a thumbnail. 这将返回一个CGImage,您可以将其用作缩略图。 See documentation here: https://developer.apple.com/documentation/quicklook/1402623-qlthumbnailimagecreate 请参阅此处的文档: https : //developer.apple.com/documentation/quicklook/1402623-qlthumbnailimagecreate

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM