[txmt-dev] Re: Declaring imported UTIs from tmBundle?

Per Persson persquare at mac.com
Sat May 21 13:46:05 UTC 2016


> On 17 maj 2016, at 10:54, Allan Odgaard <mailinglist at textmate.org> wrote:
> 
> On 16 May 2016, at 23:25, Per Persson wrote:
> 
>> IIRC there was a discussion a couple of years ago about letting TM declare imported UTIs. Does anyone know the current status?
> 
> The problem is that this information must be in the application’s Info.plist, so if TextMate were to import this from bundles, it would have to rewrite its own Info.plist which was problematic at the time (file permissions) and today is somewhat out of the question (code signing).

TextMate doesn't necessarily have to modify its own Info.plist, right? By constructing a helper app, e.g. in Application Support, with a tailored Info.plist based on info collected from the active bundles, and then using lsregister to register/unregister UTI types there wouldn't be any need to even run it (example below, based on http://apple.stackexchange.com/a/175395). 

/Per


with:

 ~$ alias lsregister=/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister

register:

 ~$ lsregister /Applications/UTImportCalvin.app
 ~$ lsregister -dump | grep -A 4 CalvinScript
		description:   CalvinScript
		flags:         imported  active  apple-internal  untrusted  
		icon:          
		conforms to:   public.script, public.source-code
		tags:          .calvin

unregister:

 ~$ lsregister -u /Applications/UTImportCalvin.app
 ~$ lsregister -dump | grep -A 4 CalvinScript
 (empty output)

where UTImportCalvin.app's Info.plist contains:

...
	<key>UTImportedTypeDeclarations</key>
	<array>
		<dict>
			<key>UTTypeConformsTo</key>
			<array>
				<string>public.script</string>
				<string>public.source-code</string>
			</array>
			<key>UTTypeDescription</key>
			<string>CalvinScript</string>
			<key>UTTypeIdentifier</key>
			<string>com.github.ericssonresearch.calvin-base</string>
			<key>UTTypeTagSpecification</key>
			<dict>
				<key>public.filename-extension</key>
				<array>
					<string>calvin</string>
				</array>
			</dict>
		</dict>
	</array>
...










More information about the textmate-dev mailing list