| ログイン | ご入会 |
ADC連絡先
|
|
|
|
pl yourPropertyListFile |
単一のファイルで構成されているアプリケーション(バンドルされていないアプリケーション)では必ず以下のキーを定義して下さい。
CFBundleIdentifier
CFBundleName
CFBundlePackageType
CFBundleSignature
CFBundleVersion
CFBundleShortVersionString
CFBundleLongVersionString
CFBundleIconFile
NSHumanReadableCopyright
NSAppleScriptEnabled
CFBundlePackageType(ファイルタイプ)とCFBundleSignature(クリエータコード)は、各々実行ファイルのファイルタイプとクリエータコードと一致しなければなりません。
LaunchServicesはNSAppleScriptEnabledキーを見ることで、ClassicまたはシングルファイルCFMアプリケーションがスクリプティングに対応しているかどうかを判断しています。以前、'aete'リソースの有無がこの役目を果たしていました。
以下のキーは必須ではありませんが、該当するキーを定義することをお勧めします。
LSPrefersCarbon
LSPrefersClassic
LSRequiresCarbon
LSRequiresClassic
|
注意: |
LSPrefersCarbonとLSPrefersClassicは、Mac OS X Finderの「情報を見る」の「Classic環境で開く」チェックボックスの設定により、デベロッパが指定したデフォルトをユーザーが上書きすることを許します。LSRequiresCarbonとLSRequiresClassicはユーザーが変更することはできません。
アプリケーションがドキュメントを開く事をサポートする場合は、ドキュメントタイプ毎に以下の項目を定義して下さい。
CFBundleTypeExtensions - このファイルタイプの拡張子
CFBundleTypeOSTypes - このファイルタイプのOSType
CFBundleTypeIconFile - このファイルタイプのアイコンのリソースID
CFBundleTypeName - このファイルタイプのFinderなどで表示されるべき名前
CFBundleTypeRole - このファイルタイプに対するアプリケーションの役割(EditorまたはViewer)
LSTypeIsPackage - このドキュメントはCFBundleOSTypeまたはCFBundleFileExtensionで定義されたパッケージである。デフォルトはオフ。アプリケーションがドキュメントをパッケージとして扱う場合に“YES”にする。(例: TextEditの.rtfd、Project Builder の.pbproj。)
'plst'のサンプル例として、SimpleTextの'plst'を示します。
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist SYSTEM "file://localhost/System/Library/DTDs/PropertyList.dtd"> <plist version="0.9"> <dict> <key>CFBundleInfoDictionaryVersion</key> <string>6.0</string> <key>CFBundleIdentifier</key> <string>com.apple.SimpleText</string> <key>CFBundleName</key> <string>Simple Text</string> <key>CFBundlePackageType</key> <string>APPL</string> <key>CFBundleSignature</key> <string>ttxt</string> <key>CFBundleDevelopmentRegion</key> <string>English</string> <key>LSPrefersCarbon</key> <true/> <key>CFBundleVersion</key> <string>1.4</string> <key>CFBundleShortVersionString</key> <string>1.4</string> <key>CFBundleLongVersionString</key> <string>1.4, Copyright 1985-2001 Apple Computer</string> <key>CFBundleIconFile</key> <string>128</string> <key>NSApplescriptEnabled</key> <Boolean>Yes</Boolean> <key>NSHumanReadableCopyright</key> <string>Copyright (c) 1985-2001 Apple Computer</string> <key>CFBundleDocumentTypes</key> <array> <dict> <key>CFBundleTypeOSTypes</key> <array> <string>TEXT</string> </array> <key>CFBundleTypeIconFile</key> <string>129</string> <key>CFBundleTypeName</key> <string>Text document</string> <key>CFBundleTypeExtensions</key> <array> <string>txt</string> <string>text</string> </array> <key>CFBundleTypeRole</key> <string>Editor</string> </dict> <dict> <key>CFBundleTypeOSTypes</key> <array> <string>ttro</string> </array> <key>CFBundleTypeIconFile</key> <string>130</string> <key>CFBundleTypeName</key> <string>Read Only document</string> <key>CFBundleTypeRole</key> <string>Viewer</string> </dict> <dict> <key>CFBundleTypeOSTypes</key> <array> <string>PICT</string> </array> <key>CFBundleTypeIconFile</key> <string>131</string> <key>CFBundleTypeName</key> <string>PICT document</string> <key>CFBundleTypeExtensions</key> <array> <string>pict</string> </array> <key>CFBundleTypeRole</key> <string>Viewer</string> <key>CFBundleTypeSuffixes</key> <array> <string>pict</string> </array> </dict> </array> </dict> </plist> |
CFBundleIconFileとCFBundleTypeIconFileCFBundleIconFileとCFBundleTypeIconFileの値は'icns'リソースのIDを指します。アプリケーションがシングルバイナリでなくバンドルパッケージの場合は、この値はバンドルの中の.icnsファイルを指します。これらの変更の結果を確認するには、Mac OS Xで一度ログインし直す必要があります。
CFBundleDocumentTypesのCFBundleTypeOSTypesTN 1085(Using the Drag Manager to Interact with and Manipulate File System Entities)にありますように、クリエータコードが'MACS'でファイルタイプが'fold'や'disk'は、Finderにアプリケーションアイコンへのフォルダーやボリュームのドロップが可能である事を示します。これらのタイプは CFBundleTypeOSTypesとしても有効ですが、ドロップできるかどうかの判断にはファイルタイプのみが用いられますので、クリエータコードを指定する必要はありません。またこれは、CFBundleTypeExtensionの値として指定されたドキュメントの拡張子に対しても同様です。
CSResourcesFileMappedCSResourcesFileMappedキーがオンだと、CFBundleはアプリケーションのリソースフォークをファイルマップされた形で開きます。ファイルマップされたリソースフォークへの書き込みは禁止されています(セグメンテーションエラーとなります)が、大きな利点が2つあります。1つ目はリソースマップがすべてメモリに読み込まれない点です。リソースマップは必要な部分だけが読み込まれます。2つ目はリソースハンドルが特別扱いされることです。リソースハンドルはメモリ内でコピーが作られるのではなく、ファイルマップされたデータをそのまま参照するよう仕組みとなります。CSResourcesFileMappedキーはBooleanでデフォルトの値はfalseです。
'carb'リソースID 0の空(サイズがゼロバイト)の'carb'リソースは、Mac OS XにこのアプリケーションがCarbonアプリケーションであると知らせる初期の方法でした。'plst'リソースは'carb'リソースに取ってかわりますが、1つ例外があります。Mac OS 9.1では'carb'リソースを持ったアプリケーションはProcess Managerがスタックとヒープメモリを若干増やします。
関連情報が、Mac OS X Release NotesのInfoPlistsとCFBundles、System Overview、Core Foundation documentationのproperty list key servicesとconcepts にあります。