Skip to content

Instantly share code, notes, and snippets.

@dirkstoop
Created January 7, 2011 17:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dirkstoop/769757 to your computer and use it in GitHub Desktop.
Save dirkstoop/769757 to your computer and use it in GitHub Desktop.
quick and dirty way to see what NSWorkspace thinks a file's UTI is…
#!/usr/bin/env python
from AppKit import NSWorkspace
import sys
if __name__ == '__main__':
if not len(sys.argv) > 1:
print 'Usage: getuti path'
sys.exit(1)
else:
print NSWorkspace.sharedWorkspace().typeOfFile_error_(sys.argv[1], None)[0]
@dirkstoop
Copy link
Author

I wrote this little nugget at least 20 times, whenever I need to debug UTI-related stuff. Here so I hopefully remember it's here.

Usage:

  1. put somewhere in your PATH,
  2. chmod to executable,
  3. getuti
  4. You'll have NSWorkspace's opinion, which is likely what you'd be using in your Cocoa app for that purpose too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment