[TxMt] Re: best example for user-configurable bundle-specific preferences

Phil Schumm pschumm at uchicago.edu
Wed Mar 27 11:07:18 UTC 2013


On Mar 27, 2013, at 5:29 AM, Allan Odgaard wrote:
> This would be for 1.x. The nib will bind to the program’s user defaults, which is `~/Library/Preferneces/«app-identifier».plist`. In 2.0 we have introduced the `TM_APP_IDENTIFIER` variable that should be used to access this file.
> 
> E.g. to read the LaTeX bundle’s ‘Viewer’ setting, from shell:
> 
>    defaults read "$TM_APP_IDENTIFIER" latexViewer
> 
> And from ruby:
> 
>    require "#{ENV['TM_SUPPORT_PATH']}/lib/osx/plist"
> 
>    settings_path = "#{ENV['HOME']}/Library/Preferences/#{ENV['TM_APP_IDENTIFIER'] || 'com.macromates.textmate'}.plist"
>    settings = open(settings_path) { |io| OSX::PropertyList.load(io) }
> 
>    puts settings['latexViewer']


Thanks!


-- Phil



More information about the textmate mailing list