finder

Getting the full path of a TFENode in Lion

拟墨画扇 提交于 2019-11-28 01:22:35
问题 I'm trying to get the full path of a TFENode in OSX Lion, but am unable to get a result using the old way (by converting to an FINode and getting the fullPath - the method [[FINode nodeWithFENode:myTFENode] fullPath] doesn't seem to work for Lion anymore. Is there a way to do this? 回答1: From a TFENode, you can get an OpaqueNodeRef, and use that with FINode's nodeFromNodeRef: method. After that, you can get the NSURL to the item with FINode's previewItemURL method. 来源: https://stackoverflow

How to launch the default (native) application for a given file from Java?

本秂侑毒 提交于 2019-11-27 14:13:13
I am displaying a list of files; i.e. xls, doc, pdf, odt etc., in my Java application (Eclipse RCP). When the user clicks on the file, I want to launch the appropriate (according to what the OS thinks) native application, just like it happens in Windows Explorer or the Finder. And while I am here: It would be nice to also display the same icons that Finder or Explorer use for the different file types. Is there a library or Eclipse plugin for this? Joseph Gordon What you want is java.awt.Desktop : Desktop.getDesktop().open( file ); I have found an API in Eclipse's SWT now that seems to do the

Mac OS X 'compress' option vs command line zip (why do they produce different results?)

回眸只為那壹抹淺笑 提交于 2019-11-27 06:45:50
问题 I noticed that the command line 'zip' tool and Mac OS X's 'Compress XXX' option (available via right click in finder) are giving different output files. Not only is the size of the file a few hundred bytes bigger but the content is significantly different as well. How can I find out what command the Finder is using for compression? 回答1: Take a look at An AppleScript to compress a Finder selection article. try tell application "Finder" set theSelection to the selection set selectionCount to

How do you programmatically put folder icons on the Finder sidebar, given that you have to use a custom icon for the folder?

梦想与她 提交于 2019-11-27 05:44:19
问题 Am currently working on a project, and though I can add sidebar items by adding to the com.apple.sidebarlists.plist file then restarting Finder, I can't seem to know how to make the folder icons show up using its assigned custom icon. Can anyone point me to a link or a solution that would make me do this? Thanks a bunch in advance! 回答1: There's no supported way to do this using pure Cocoa. Use the LSSharedFileList API, instead. It's the supported way to manage the sidebar lists, and you can

Swift 3: Set Finder label color

末鹿安然 提交于 2019-11-27 02:00:24
问题 I'm trying to set the colored labels shown by the finder. The only function I know is setResourceValue. But this needs localized names! I could image my mother language and english as well, but all others I don't know. I can't believe, that this should be the way. Is the are translation function, which takes a standard parameter like an enum or int and delivers the localized color name? I have an running part, but only for two languages (German and English): let colorNamesEN = [ "None", "Gray

Tagging files with colors in OS X Finder from shell scripts

六眼飞鱼酱① 提交于 2019-11-27 01:11:23
问题 One can tag files and folders with a color in the Mac OS X Finder. Is there a way to do this from a shell script? 回答1: This shell script takes the file or folder name as its first argument and the label index (0 for no label, 1 for red, ..., 7 for gray) as its second argument. #!/bin/sh osascript -e "tell application \"Finder\" to set label index of alias POSIX file \"`cd -P -- "$(dirname -- "$1")" && printf '%s\n' "$(pwd -P)/$(basename -- "$1")"`\" to $2" More directly, if $filename is a

How to Write OS X Finder plugin

元气小坏坏 提交于 2019-11-26 02:48:51
问题 I\'m looking for a guide or sample code for writing Mac OS X Finder plugins? It would like to know how to do some simple actions: adding image overlayers to icons adding context menu items listen to file changes I found the following two resources: Writing Contextual Menu Plugins for OS X: An outdated document from 2002 that uses the COM API targeting Mac OS X 8/9. SCPlugin: Open-source SVN Mac application that includes a Finder plug-in. I am tempted to review the SCPlugin code, but was