简体   繁体   English

如何确定 Finder 中当前是否显示不可见文件?

[英]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.非常感谢任何帮助,谢谢。

Finder发现者

It's irrelevant if com.apple.finder AppleShowAllFiles contains false or true .如果com.apple.finder AppleShowAllFiles包含falsetrue ,则无关紧要。 You probably misunderstood how it activates file viewer with URLs.您可能误解了它如何通过 URL 激活文件查看器。

Example:例子:

  • /Users/zrzka/.rustup
    • Finder is activated with content of the /Users/zrzka folder Finder 使用/Users/zrzka文件夹的内容激活
    • .rustup folder is selected .rustup文件夹被选中
  • /Users/zrzka/.rustup/toolchains
    • Finder is activated with content of the /Users/zrzka/.rustup folder Finder 使用/Users/zrzka/.rustup文件夹的内容激活
    • toolchains folder is selected toolchains文件夹被选中

在此处输入图像描述

Sandbox沙盒

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.

相关问题 如何使用objective-c在Finder中使文件不可见 - How to make a file invisible in Finder using objective-c 如何检查具有给定扩展名的目录是否由Finder打包显示? - How to check whether directories with a given extension are shown by the Finder as a package? 如何确定当前可见的UICollectionView单元格的indexPath - How to determine indexPath of currently visible UICollectionView cell 以编程方式确定Finder窗口的'pathbarVisible' - Programmatically determine 'pathbarVisible' for a Finder window 查找当前活动的 Finder 窗口/文件夹 - Find the currently active Finder window/folder 如何在OS X Finder中有条件地为文件和文件夹着色? - How can I conditionally color files and folders in the OS X Finder? 如何以编程方式确定OS X中当前处于活动状态的App? - How to programmatically determine the currently active App in OS X? 如何确定Coreplot中X轴上当前可见的数据计数 - How to determine the data count that is currently visible on the xaxis in coreplot 如何确定坐标是否在当前可见的地图区域中? - How do I determine if a coordinate is in the currently visible map region? 如何确定某个文本是否在UITableViewCell中完全显示? - How to determine if a certain text is being completely shown in UITableViewCell?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM