Q:  I'm building a bundle project, but I want the bundle to have a different extension than the default .bundle so I can treat it as a document for my own application or for an application like Preferences or BackSpace.

A:  When bundles were originally released it was thought that they would only be used to dynamically load infrequently used parts of an application.  However, it's now very common and even encouraged to make your application extensible by having it accept bundle documents at runtime.  Applications like Preferences, BackSpace and IconBuilder all do this. Since these bundles are essentially unique file formats (you wouldn't, for instance, try to load a BackSpace module into Preferences) they need unique extensions.

In Release 3.0 and 3.1 you can change the extension of a bundle from its default of .bundle by adding the following lines to the Makefile.preamble and Makefile.postamble respectively:

Addition to Makefile.preamble

Add the following to Makefile.preamble to set a new extension and install directory (replace XXXX with the new extension and AppName with your application's name):

	BUNDLE_EXT = .XXXX
	INSTALLDIR = $(HOME)/Library/AppName
	OTHER_PRODUCT_DEPENDS = $(NAME)$(BUNDLE_EXT)
	OTHER_GARBAGE = $(NAME)$(BUNDLE_EXT)

Addition to Makefile.postamble

Add the following to Makefile.postamble to build the bundle with the new extension:

Remove the old version of the named bundle before installation:

	before_install::
		rm -rf $(DSTROOT)$(INSTALLDIR)/$(NAME)$(BUNDLE_EXT)

Move the bundle to its new extension after installation:

	after_install::
		mv $(DSTROOT)$(INSTALLDIR)/$(NAME).bundle    \
			$(DSTROOT)$(INSTALLDIR)/$(NAME)$(BUNDLE_EXT)

Link the bundle to its new extension for incremental building/testing:

	$(NAME)$(BUNDLE_EXT):
		-ln -s  $(NAME).bundle $(NAME)$(BUNDLE_EXT)

In Release 3.2 this problem will be fixed by the addition of the BUNDLE_EXTENSION macro. You can simply set this macro in the Makefile.preamble to get the new extension.

QA888

Valid for 3.0, 3.1