Force item icon refresh in Finder 10.8.2 - objective-c

Can anyone lead me to any useful link for forcing file icon refresh in new 10.8.2 version of 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).
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.
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.
Any idea or suggestion will be highly appreciated.

If you need to update one Application icon, just touch the App.app folder.
Close the finder windows and issue the command:
touch /Applications/App.app

Create a visible file and delete it. This will refresh finder window.

To reset for every application under Mountain Lion, try the following in Terminal:
/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).
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.

Type into Terminal
killall Finder
Then
killall Dock

I had this problem too. I had a .app i wanted to change the icon of.
Structure of my .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.
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:
Open the "Get Info Window" of the bundle you want to update and select the icon by clicking on it.
Paste another image as the icon (you could have copied this from another file or from any other location with this pasteboard data).
Press return and make sure the icon changed in the Finder.
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.

Related

Making localization work

I have an app that needs to be localized.
After fiddling with the settings for a while, I managed to get the project to the state where it builds a nl.lproj (amongst others) directory in the Resources directory of the app bundle, which contains a MainMenu.strings file that contains all my translations; they seem correct at first glance.
The XIB file is marked as translatable, and seems to be part of the right target:
However, if I run the app in a dutch environment, the localized strings are not shown in the UI. I added
NSLocale *loc = [NSLocale autoupdatingCurrentLocale];
NSString *lang = [loc languageCode];
NSLog(#"Current language: %#",lang);
to verify that the Dutch language is active, and it is.
This question suggests that doing a clean followed by a rebuild of the app should fix such issues. I've tried that, but it did not resolve the issue.
How can I figure out why my app isn't being translated? What else could go wrong? Are there any diagnostics I could be checking?
The application in question is open source, and can be found at https://github.com/Fedict/eid-mw. Select the "eID Viewer" target, and build that, to see what's happening.
There are two different things with the localization. One is localization the UI. This is done by checking those boxes and then editing the string files in the dialog underneath the xib file.
The second is the localization of the Userfacing strings in code. This is done by the Macro NSLocalizedString(#"*key*", *comment*); where key is the key and comment is a provided comment for localization purpose.
These strings are the to edit in the File Localizable.strings.
Here a link with a Beginner Tutorial. And the Apple Docs
To activate the debug function in Xcode for localized strings: pass in -NSShowNonLocalizedStrings YES as launch argument in Xcode. You find it under Product/Scheme/Edit Scheme -Arguments
Hope this helps
You need called .strings file with name "Localizable.strings".
And add language target ( in inspector ) and fill target language file.
Have you tried a check with pseudolocalozations?
Are you setting properly the language and region on your mac?
Are you also trying launching it specifically in Dutch from XCode:
To launch your app in a specific language and region
Click the target in the Run destination menu and choose Edit Scheme.
On the right, select Options.
Optionally, choose a language from the Application Language pop-up menu.
Optionally, choose a region from the Application Region pop-up menu.
Click the Close button.
Click Run to launch your app in the language and region you specified.
It turns out that localisation is supported with OSX 10.8 and above. My app had selected 10.7 as deployment target (we do need to support a few older versions of OSX). Switching the deployment target to 10.8 makes the translations appear.

Finder window refresh issue (Yosemite )

I am working on Finder Sync extension to apply badges on files and folders ...
I want to refresh icon for particular file/folder in Finder application.
is there any way to refresh a finder window programmatically on mac OS Yosemite ???
Apart from creating and deleting a file...
I had this problem too. I had a .app i wanted to change the icon of.
Structure of my .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.
Very interesting.

How to have folders first before any file in finder (Mac) programmatically?

I am new to Mac OS. I want to have the folders first before any other file in finder through my cocoa app.
Can anyone suggest me a way of doing this like xtraFinder, PathFinder etc apps do?
I have gone through the followings links. One way is this:
http://hints.macworld.com/article.php?story=2011072120153685
http://mygeekdaddy.net/2013/10/24/change-mavericks-finder-app-sort-order/
And the other way I got is to drag the folders to first in the spotlight (in system preferences) then sort by kind.
But in both ways I don't know how to do this programmatically. Can anyone tell me step by step how to do this through my app?
OS X Sierra finally has an option for this:
Open Finder
Go to Finder Menu -> Preferences
Go to "Advanced" tab
Check the "Keep folders on top when sorting by name"
Now, When you sort by name, can see folders at top of files (like as windows)
Good Luck ;)
For Mavericks and Yosemite: From any Finder window either right-click in the window or select the icon that looks like a gear from the menu bar.
Next, select "Show View Options".
Set "Arrange by" to Name.
Set "Sort by" to Kind.
Optionally, you can save these settings as a default.
Also note that you may need to do this for each drive and/or "top" folder.
I pretty much like everything mac, but this windows-like feature is kinda nice to your eyes.
thanks
Memariaan solutions also works in 10.14.2 Mojave but there are two selections now instead of one.
According to crunchgeek (And validated myself on Mac OSX 10.9.5)
cd /System/Library/CoreServices/Finder.app/Contents/Resources/English.lproj/
sudo plutil -convert xml1 InfoPlist.strings
sudo nano InfoPlist.strings
Now change <string>Folder</string> by adding a space to get <string> Folder</string>. Finally "encode [the] file back into binary format."
sudo plutil -convert binary1 InfoPlist.strings
Now open Finder View Options via Command+J and select Kind under "Sort by".
To make the folders come first in finder, change the order of data categories in spotlight.
Hit Command plus spacebar and then type spotl. That opens spotlight preferences. You will see all the data categories you have checked, or are checked by default. Simply drag "folders" to the top of the list. You can also arrange all the data categories in the order you want. So when you are looking in Finder and opt to arrange by "kind" the folder show up first together with any other changes in the order that you made.
Thanks to David Pogue's OSX Yosemite, the missing manual, Page 132.

How to delete projects in IntelliJ 12?

I created some dummy projects. Now I don't see any way to delete the projects that I don't want. Per this suggestion I can delete files, the project is going away but there is traces of it still available. For example, on the Recent Projects you can still see the name of the project you just deleted. So I am thinking there should be another (and really easy way) to delete a project.
Press the Del (or fn and delete) key to delete a project from the Recent Projects list.
Vote for this issue to make it more obvious and user friendly.
close project first, or until this dialog appear, then hover your mouse on project you want to delete from history, then press Del
you'll be asked for confirmation
On occasion, even with deletion of the project, some tidbits are left behind in the following Windows paths:
C:\Users\username.domain\.IntelliJIdea2017.1\system\compiler
C:\Users\username.domain\.IntelliJIdea2017.1\system\compile-server
C:\Users\username.domain\.IntelliJIdea2017.1\system\frameworks\detection
C:\Users\username.domain\.IntelliJIdea2017.1\system\conversion
C:\Users\username.domain\.IntelliJIdea2017.1\config\componentVersions
C:\Users\username.domain\.IntelliJIdea2017.1\config\tasks
This has been proven to be problematic - for example, if a new project is created using a previously deleted project name, it will create the project with data stored in the above paths, at least, this has been my experience.
The only way to TRULY delete the project is to get rid of all the garbage left behind in the aforementioned folders. I would suggest using Search Everything to find more tidbits left in the users temp folders.
In case your project is imported as a module, you can also go to File --> Project Structure and click 'Modules' in the left section. Now you can hit the minus button to remote the module from the project.
You can also click File -> Open project ...
When a file menu appears, you can right click the unwanted project folder and select Delete.
Just figured, I am using Idea Community edition 13.1.1 and the cleanest and easiest way is to go to File > Reopen project > Clear List. I just stumbled upon this menu today. I always thought that is just to clear the latest projects from the view inside the IDE and just realized it is clearing the projects from the main Dialog too.
-VRS
Also, in IDEA 13.x.x you can go File-> Close Project and you'll land in the window with Recent Projects tab. There pressing Del of Fn + Del on selected project helps .
On OSX Mountain Lion and IDEA 14, with the project open and focused, you can go to file -> close project, then delete the project from your filesystem. This removed all references to the project.
Note that if the project you are deleting is the only project open, closing it will show the welcome dialog, which will still show the project. Deleting the project manually from within your operating system is the next step, and the project will still appear in the welcome dialog until it is closed and shown again, usually by opening another project from the list, or quitting and restarting IDEA.
In my case, I had to delete home/.IntelliJIdea2017.2/config/options/recentProjects.xml
. In my file system (Ubuntu) this file appeared for some weird reason not writable and hold a list of projects I couldn't get rid of. Deleting this file and restarting will force Intellij IDEA to create a new one with an empty list of projects.
All you have to do is go to file - close project - to avoid seeing them again in the menu list and then you delete them from the projects directory.

Where to find the Objective-C Runtime and Headers?

The documentation says:
/usr/include/objc
However, on my mac there is no such folder anywhere. Or can't I just see these with Finder? If so what Tools do I need to take a lookt at them? I'm just very interested to see these headers. Just for fun.
Not sure what "documentation" you're looking at, but the header files for the system frameworks can be found under their containing frameworks at /System/Library/Frameworks. So NSObject.h resides at /System/Library/Frameworks/Foundation.framework/NSObject.h.
Edit: I just checked both my machines (Tiger and Snow Leopard), and they both have /usr/include/objc/ also. So not sure why you don't.
In Finder, press shift-cmd-G and type /usr/include/objc
Or you could go to the "Go" menu in Finder and select "Go to Folder..."
It's a hidden folder.
Do you have XCode/SDK installed? If not - register at http://developer.apple.com and get them.
The folder exists and is indeed hidden from the Finder. You can show it if you know what you're doing, but it can also lead to problems if you ever accidentally delete or move something in the /usr hierarchy. Instead, use a terminal if you want to read the headers.
You can open objc.h in XCode by jumping to the definition of id, SEL or Class (in a source file, cmd-doubleclick the name or right-click it & choose "Jump to definition"; with id, then click "typedef id").
I was having a similar issue on my Mac OS 10.8 machine, so I did a bit of digging through the Xcode files. It would appear that, for reasons I cannot entirely explain, newer versions of Xcode have these file embedded in their packages.
To find them, right click on Xcode.app and select Show Package Contents. Then navigate to the following path:
Xcode.app/Contents/Developer/Platforms
This directory should include three folders, one for Mac OS X, one for iOS, and one for the iPhone simulator. Each contains its own set of header files and resources. As an example, say I chose the Mac OS X platform. The objc headers can be found in this directory:
MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/usr/include/objc/
As to why they are here and not in /usr/include/objc, I do not know. On a similar Mac machine also running OS X 10.8, I found them in their proper locations. However, this should be a somewhat accurate method of locating them if they are not there.