简体   繁体   English

在Finder 10.8.2中强制项目图标刷新

[英]Force item icon refresh in Finder 10.8.2

Can anyone lead me to any useful link for forcing file icon refresh in new 10.8.2 version of Finder? 任何人都可以带我到任何有用的链接强制文件图标刷新在新的10.8.2版本的Finder?

I'm working on this problem for last few days and I have tried almost any solution which can be found on internet, but those are all old samples which are compatible with old versions of Finder and do not work on newer versions of Finder (which are rebuilt on Cocoa framework). 我正在研究这个问题最近几天,我已经尝试了几乎任何可以在互联网上找到的解决方案,但这些都是旧的样本,与旧版本的Finder兼容,不适用于较新版本的Finder(其中在Cocoa框架上重建)。

I tried to use few commands from apple script tool to update files in Finder ('update item with necessity'), I tried few plugins from internet (nudge, finder-Refresh...), I also tried support for communication with external Mac application through ScriptingBridge framework (although very useful) but nothing gave me a desired result. 我尝试使用苹果脚本工具中的一些命令来更新Finder中的文件('更新项目有必要'),我尝试了几个来自互联网的插件(nudge,finder-Refresh ...),我也试过支持与外部Mac的通信应用程序通过ScriptingBridge框架(虽然非常有用),但没有给我一个理想的结果。

I have noticed that NSWorkspace class contains two methods: iconForFile and setIcon:forFile, and although I could integrate this two functions in application, iconForFile function is returning image of reduced quality, so I'm stuck in that direction also. 我注意到NSWorkspace类包含两个方法:iconForFile和setIcon:forFile,虽然我可以在应用程序中集成这两个函数,但是iconForFile函数返回质量降低的图像,所以我也停留在那个方向。

Any idea or suggestion will be highly appreciated. 任何想法或建议将受到高度赞赏。

Create a visible file and delete it. 创建一个可见文件并将其删除。 This will refresh finder window. 这将刷新查找器窗口。

I had this problem too. 我也有这个问题。 I had a .app i wanted to change the icon of. 我有一个.app我想改变它的图标。

Structure of my .app : 我的.app结构:

  • ...noida.app/
    • ...noida.app/Contents/
      • ...
    • ...noida.app/Contents/Resources
      • ...noida.app/Contents/Resources/myicon.icns
    • ...noida.app/Contents/MacOS
      • ...
    • ...noida.app/Contents/plist.Info

Now I would change the icon in the resources folder. 现在我将更改资源文件夹中的图标。 Then I made new files in all folders. 然后我在所有文件夹中创建了新文件。 It wouldn't work. 它不会起作用。 The only place that i could make a new file tha twould update the icon was in the ...noida.app/ so i made new file at ...noida.app/junk folder and then it updated. 我可以创建一个新文件的唯一地方是更新图标是在...noida.app/所以我在...noida.app/junk folder了新文件,然后更新了。

Very interesting. 很有意思。

I was just fighting with this on 10.10 (although it's been a problem for years now) and the only solution I found to force refreshing a bundles icon in the Finder was to: 我只是在10.10上与此斗争(虽然这已经成为问题多年了)而且我发现在Finder中强制刷新捆绑图标的唯一解决方案是:

  1. Open the "Get Info Window" of the bundle you want to update and select the icon by clicking on it. 打开要更新的捆绑包的“获取信息窗口”,然后单击选择图标。
  2. Paste another image as the icon (you could have copied this from another file or from any other location with this pasteboard data). 将另一个图像粘贴为图标(您可以从另一个文件或使用此粘贴板数据的任何其他位置复制此图像)。
  3. Press return and make sure the icon changed in the Finder. 按返回并确保在Finder中更改了图标。
  4. Delete the icon by pressing the delete key. 按删除键删除图标。

After that the bundles icon was refreshed to the new .icns file in the bundles resource folder. 之后,bundle图标被刷新到bundles资源文件夹中的新.icns文件。

Type into Terminal 输入终端

killall Finder

Then 然后

killall Dock

If you need to update one Application icon, just touch the App.app folder. 如果您需要更新一个应用程序图标,只需触摸App.app文件夹即可。

Close the finder windows and issue the command: 关闭取景器窗口并发出命令:

touch /Applications/App.app

To reset for every application under Mountain Lion, try the following in Terminal: 要重置Mountain Lion下的每个应用程序,请在终端中尝试以下操作:

/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister -kill -seed -r

That will kill all existing objects in launch services and reseed them recursively from the standard locations (/Applications, etc). 这将终止启动服务中的所有现有对象,并从标准位置(/ Applications等)递归地重新设置它们。

If you have a specific application whose data you need to override existing information, you can try: 如果您有一个特定的应用程序,您需要覆盖现有信息的数据,您可以尝试:

/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister -f <path>

Although I've had limited luck with the latter working in some cases, so you may end up doing the former afterwards. 虽然后者在某些情况下工作的运气有限,但你可能最终会做到前者。

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

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