Structure of an Installable Bundle

  • 版本网址缩略名: Bundles
  • 版本标题: Structure of an Installable Bundle
  • 版本 id: 165235
  • 创建于:
  • 创建者: Freeopen
  • 是否是当前版本?
  • 评论 /* Platform-specific Subdirectories */

修订内容

XULRunner applications, extensions, and themes all share a common directory structure, and in some cases the same bundle can be used as a standalone XULRunner application as well as an installable application extension.


一个Bundle的基础结构

一个bundle可以包括如下文件:

/install.rdf                        扩展/主题安装配置文件
/application.ini                    应用启动配置文件
/components/*                       组件和XPT文件      (>=1.7)
/defaults/preferences/*.js          缺省属性          (>=1.7)
/plugins/*                          NPAPI插件                (>=1.8)
/chrome.manifest                    Chrome注册配置文件 (>=1.8)
/chrome/icons/default/*             Window图标                 (>=1.8)

当然,一个扩展不必(并且通常不会)有所有这些目录。主题由于安全原因受到限制,通常只提供一个chrome.manifest注册和一个JAR文件。

Platform-特殊的子目录

In some cases a single extension or application may wish to include binary component or plugins for multiple platforms, or theme authors might want to include multiple platform-specific JAR files. To facilitate the first case, the extension/app loader has special sub-directories specifically for platform-specific files (starting with Toolkit/Gecko 1.8, Firefox/Thunderbird 1.5). The platform string is defined during the toolkit build process to a value unique for the combination of operating system, processor architecture and compiler. The format of the platform string is:

{OS_TARGET}_{TARGET_XPCOM_ABI}

All of the files which are loaded from the main extension directory are loaded from the subdirectory

/platform/{platform string}

if it exists. 比如, 如果一个插件厂商想为运行Linux, Macintosh, 和Windows操作系统客户电脑提供一个可用的插件,它将提供如下文件:

/platform/Linux_x86-gcc3/plugins/libMyPlugin.so
/platform/WINNT_x86-msvc/plugins/MyPlugin.dll
/platform/Darwin_ppc-gcc3/plugins/libMyPlugin.dylib

因为XPT文件没有平台指定,任何相关的XPT文件将被放在一般的组件目录下:

/components/MyPlugin.xpt

If an extension has non-binary platform-specific code (such as code which uses the windows registry from script), it can also use just the operating system identifier as a platform-subdirectory:

/platform/WINNT/components/registerDoctype.js

When platform-specific JAR files are used, each platform directory should have its own chrome.manifest file:

chrome.manifest
chrome/mytheme-base.jar
platform/Darwin/chrome.manifest
platform/Darwin/chrome/mytheme-mac.jar
platform/WINNT/chrome.manifest
platform/WINNT/chrome/mytheme-win.jar

The app/extension loader processes the base directory first, followed by the applicable platform directories (first /{OS_TARGET}/, then /{OS_TARGET}_{TARGET_XPCOM_ABI}/). When default preferences are defined in several directories, the ones loaded later overwrite the earlier ones.

Application-specific Extension Files

In addition to the extension files listed above, applications may read additional files from extensions. For example, Firefox 1.5 and greater will read Sherlock search plugins from

/searchplugins/*.src

Firefox 2 and greater will additionally read MozSearch and OpenSearch plugins from

/searchplugins/*.xml

and Myspell dictionaries from

/dictionaries/*.{aff|dic}

Official References for Toolkit API

{{wiki.template(':cn/Toolkit_API/Official_References')}}

{{ wiki.languages( { "es": "es/Bundles", "fr": "fr/Bundles", "ja": "ja/Bundles", "ko": "ko/Bundles", "pl": "pl/Paczki" } ) }}

修订版来源

<p> 
</p><p><a href="cn/XUL_Application_Packaging">XULRunner applications</a>, <a href="cn/Extensions">extensions</a>, and <a href="cn/Themes">themes</a> all share a common directory structure, and in some cases the same bundle can be used as a standalone XULRunner application as well as an installable application extension.
</p><p><br>
</p>
<h3 name=".E4.B8.80.E4.B8.AABundle.E7.9A.84.E5.9F.BA.E7.A1.80.E7.BB.93.E6.9E.84"> 一个Bundle的基础结构 </h3>
<p>一个bundle可以包括如下文件:
</p>
<pre class="eval">/<a href="cn/Install.rdf">install.rdf</a>                        <i>扩展/主题安装配置文件</i>
/<a href="cn/XUL_Application_Packaging">application.ini</a>                    <i>应用启动配置文件</i>
/components/*                       <i>组件和XPT文件</i>      <a href="cn/Gecko#Versions_of_Gecko">(&gt;=1.7)</a>
<a href="cn/Building_an_Extension#Defaults_Files">/defaults/preferences/*.js</a>          <i>缺省属性</i>          <a href="cn/Gecko#Versions_of_Gecko">(&gt;=1.7)</a>
/plugins/*                          <i>NPAPI插件</i>                <a href="cn/Gecko#Versions_of_Gecko">(&gt;=1.8)</a>
/<a href="cn/Chrome.manifest">chrome.manifest</a>                    <i>Chrome注册配置文件</i> <a href="cn/Gecko#Versions_of_Gecko">(&gt;=1.8)</a>
/<a href="cn/Window_icons">chrome/icons/default/*</a>             <i>Window图标</i>                 <a href="cn/Gecko#Versions_of_Gecko">(&gt;=1.8)</a>
</pre>
<p>当然,一个扩展不必(并且通常不会)有所有这些目录。主题由于安全原因受到限制,通常只提供一个<a href="cn/Chrome.manifest">chrome.manifest</a>注册和一个JAR文件。
</p>
<h3 name="Platform-.E7.89.B9.E6.AE.8A.E7.9A.84.E5.AD.90.E7.9B.AE.E5.BD.95"> Platform-特殊的子目录 </h3>
<p>In some cases a single extension or application may wish to include binary component or plugins for multiple platforms, or theme authors might want to include multiple platform-specific JAR files. To facilitate the first case, the extension/app loader has special sub-directories specifically for platform-specific files (starting with Toolkit/Gecko 1.8, Firefox/Thunderbird 1.5). The platform string is defined during the toolkit build process to a value unique for the combination of operating system, processor architecture and compiler. The format of the platform string is:
</p>
<pre class="eval"><i>{<a href="cn/OS_TARGET">OS_TARGET</a>}</i>_<i>{<a href="cn/XPCOM_ABI">TARGET_XPCOM_ABI</a>}</i>
</pre>
<p>All of the files which are loaded from the main extension directory are loaded from the subdirectory
</p>
<pre class="eval">/platform/<i>{platform string}</i>
</pre>
<p>if it exists. 比如, 如果一个插件厂商想为运行Linux, Macintosh, 和Windows操作系统客户电脑提供一个可用的插件,它将提供如下文件:
</p>
<pre class="eval">/platform/Linux_x86-gcc3/plugins/libMyPlugin.so
/platform/WINNT_x86-msvc/plugins/MyPlugin.dll
/platform/Darwin_ppc-gcc3/plugins/libMyPlugin.dylib
</pre>
<p>因为XPT文件没有平台指定,任何相关的XPT文件将被放在一般的组件目录下:
</p>
<pre class="eval">/components/MyPlugin.xpt
</pre>
<p>If an extension has non-binary platform-specific code (such as code which uses the windows registry from script), it can also use just the operating system identifier as a platform-subdirectory:
</p>
<pre class="eval">/platform/WINNT/components/registerDoctype.js
</pre>
<p>When platform-specific JAR files are used, each platform directory should have its own <code>chrome.manifest</code> file:
</p>
<pre class="eval">chrome.manifest
chrome/mytheme-base.jar
platform/Darwin/chrome.manifest
platform/Darwin/chrome/mytheme-mac.jar
platform/WINNT/chrome.manifest
platform/WINNT/chrome/mytheme-win.jar
</pre>
<p>The app/extension loader processes the base directory first, followed by the applicable platform directories (first /{OS_TARGET}/, then /{<a href="cn/OS_TARGET">OS_TARGET</a>}_{<a href="cn/XPCOM_ABI">TARGET_XPCOM_ABI</a>}/). When default preferences are defined in several directories, the ones loaded later overwrite the earlier ones.
</p>
<h3 name="Application-specific_Extension_Files"> Application-specific Extension Files </h3>
<p>In addition to the extension files listed above, applications may read additional files from extensions. For example, <a href="cn/Firefox_1.5">Firefox 1.5</a> and greater will read Sherlock search plugins from
</p>
<pre class="eval">/searchplugins/*.src
</pre>
<p><a href="cn/Firefox_2">Firefox 2</a> and greater will additionally read <a href="cn/Creating_MozSearch_plugins">MozSearch and OpenSearch plugins</a> from
</p>
<pre class="eval">/searchplugins/*.xml
</pre>
<p>and Myspell dictionaries from
</p>
<pre class="eval">/dictionaries/*.{aff|dic}
</pre>
<h3 name="Official_References_for_Toolkit_API"> Official References for <a href="cn/Toolkit_API">Toolkit API</a> </h3>
<p>{{wiki.template(':cn/Toolkit_API/Official_References')}}
</p>{{ wiki.languages( { "es": "es/Bundles", "fr": "fr/Bundles", "ja": "ja/Bundles", "ko": "ko/Bundles", "pl": "pl/Paczki" } ) }}
恢复到这个版本