[英]How to determine if invisible files are currently shown in the Finder?
In a macOS application written in Swift or Objective-C and targeted for the Mac App Store, how to determine programmatically if invisible files are currently shown in the Finder?在使用 Swift 或 Objective-C 编写并针对 Mac App Store 的 macOS 应用程序中,如何以编程方式确定 Finder 中当前是否显示不可见文件? I have tried to call
defaults read com.apple.finder AppleShowAllFiles
using NSTask
, but it does not work in the sandbox.我尝试使用
NSTask
调用defaults read com.apple.finder AppleShowAllFiles
,但它在沙箱中不起作用。 Any help is greatly appreciated, thanks.非常感谢任何帮助,谢谢。
It's irrelevant if com.apple.finder AppleShowAllFiles
contains false
or true
.如果
com.apple.finder AppleShowAllFiles
包含false
或true
,则无关紧要。 You probably misunderstood how it activates file viewer with URLs.您可能误解了它如何通过 URL 激活文件查看器。
Example:例子:
/Users/zrzka/.rustup
/Users/zrzka
folder /Users/zrzka
文件夹的内容激活.rustup
folder is selected .rustup
文件夹被选中/Users/zrzka/.rustup/toolchains
/Users/zrzka/.rustup
folder /Users/zrzka/.rustup
文件夹的内容激活toolchains
folder is selected toolchains
文件夹被选中You can ask Apple for temporary exceptions .您可以向 Apple 询问临时例外情况。 Here's more detailed answer .
这里有更详细的答案。 But it really depends on what files/folders do you want to reveal.
但这实际上取决于您要显示哪些文件/文件夹。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.