How to use Uniform Type Identifiers for this ... ?
How to use Uniform Type Identifiers for this ... ?
- Subject: How to use Uniform Type Identifiers for this ... ?
- From: Jay Reynolds Freeman <email@hidden>
- Date: Sun, 25 Oct 2009 18:57:43 -0700
I have a peculiar situation involving matching an application with its
documents; I have read the Apple stuff on Uniform Type Identifiers and
I suspect they can solve my problem, but I am slow at seeing how:
This issue comes up during development, in which case it is a bother,
but it does not really concern any shippable product.
I have an app, "MyApp", which has a user preferences file, properly
located in the user's Library/Preferences directory, and properly
named "com.Jay_Reynolds_Freeman.MyApp.plist". All is well and good
with the preferences mechanism, it works properly.
MyApp also uses a special document, a binary file that it creates,
whose precise format keeps changing as I develop the app. In general,
binary files of this kind will *only* work with the precise version of
MyApp that created them: A mismatch causes a crash. And in the
nature of development, I usually have many different recent versions
of MyApp lying around, as well as instances of the corresponding
different versions of the special document.
The binary-file documents are clickable -- you are supposed to be able
to launch the app by mousing on one. But if the wrong version of the
app gets launched by mistake, it fails. I would like to make that not
happen, mostly so that I can make sure I haven't somehow broken the
click-on-to-launch mechanism since the last time I tested it.
The click-and-launch mechanism works fine when the finder can only
"see" one version of MyApp and the only binary-file documents around
are of the matching type.
The problem is, I would like all versions of MyApp to use the same
user preferences list. What I need, in effect, is a way for all
versions of MyApp to announce themselves to the world as the same app
when connecting up with a user preferences file, but as completely
different apps when the system is trying to decide what to do with a
binary-file document that I have just moused on. That sounds like
something that the Uniform Type Identifier mechanism ought to be able
to handle, but I can't quite figure out how.
To be more specific, here is what I would like to have happen.
If I mouse on a version-42 binary-file document, the system launches
version 42 of MyApp, which then takes its preferences from
com.Jay_Reynolds_Freeman.MyApp.plist.
If I mouse on a version-43 binary-file document, the system launches
version 43 of MyApp, which then takes its preferences from (the same)
com.Jay_Reynolds_Freeman.MyApp.plist.
If I mouse on a version-44 binary-file document, the system launches
version 44 of MyApp, which then takes its preferences from (still the
same) com.Jay_Reynolds_Freeman.MyApp.plist.
I have a feeling that this is easy and that I am just being slow today.
This isn't really an XCode issue, but it might help to know that I am
running XCode 3.2.1 on MacOS 10.6.1.
Any suggestions?
-- Jay Reynolds Freeman
---------------------
email@hidden
http://web.mac.com/jay_reynolds_freeman (personal web site)
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden