diff options
Diffstat (limited to 'files/zh-cn/mozilla/tech/xpcom/reference/interface/nsidirectoryserviceprovider/index.html')
-rw-r--r-- | files/zh-cn/mozilla/tech/xpcom/reference/interface/nsidirectoryserviceprovider/index.html | 65 |
1 files changed, 0 insertions, 65 deletions
diff --git a/files/zh-cn/mozilla/tech/xpcom/reference/interface/nsidirectoryserviceprovider/index.html b/files/zh-cn/mozilla/tech/xpcom/reference/interface/nsidirectoryserviceprovider/index.html deleted file mode 100644 index 20d094eaf3..0000000000 --- a/files/zh-cn/mozilla/tech/xpcom/reference/interface/nsidirectoryserviceprovider/index.html +++ /dev/null @@ -1,65 +0,0 @@ ---- -title: nsIDirectoryServiceProvider -slug: Mozilla/Tech/XPCOM/Reference/Interface/nsIDirectoryServiceProvider -translation_of: Mozilla/Tech/XPCOM/Reference/Interface/nsIDirectoryServiceProvider ---- -<p></p><div style="border: solid #ddd 2px; margin-bottom: 12px;"> -<div style="background: #eee; padding: 2px;"><code><a href="https://dxr.mozilla.org/mozilla-central/source/xpcom/io/nsIDirectoryService.idl" rel="custom">xpcom/io/nsIDirectoryService.idl</a></code><span style="text-align: right; float: right;"><a href="/zh-CN/docs/Interfaces/About_Scriptable_Interfaces" style="color: #00cc00; font-weight: 700;">脚本化</a></span></div> -<span style="padding: 4px 2px;"> - -本接口是目录服务用于得到文件位置的函数。 -</span> - -<div style="background: #eee; padding: 2px;"> -继承于: <code><a href="/zh-CN/docs/Mozilla/Tech/XPCOM/Reference/Interface/nsISupports" title="">nsISupports</a></code> -<span style="text-align: right; float: right;">最后修改于Gecko 1.7 </span></div> -</div><p></p> -<p><code>nsIDirectoryServiceProvider</code>.</p> -<h2 id="Method_overview" name="Method_overview">方法概览</h2> -<table class="standard-table"> - <tbody> - <tr> - <td><code>nsIFile <a href="#getFile()">getFile</a>(in string prop, out PRBool persistent);</code></td> - </tr> - </tbody> -</table> -<h2 id="Methods" name="Methods">方法</h2> -<h3 id="getFile()" name="getFile()">getFile()</h3> -<p>The Directory Service calls this method when it gets the first request for a prop or on every request if the prop is not persistent.</p> -<pre class="eval">nsIFile getFile( - in string prop, - out PRBool persistent -); -</pre> -<h6 id="Parameters" name="Parameters">Parameters</h6> -<dl> - <dt> - <code>prop</code></dt> - <dd> - The symbolic name of the file.</dd> - <dt> - <code>persistent</code></dt> - <dd> - <code>true</code> if the returned file will be cached by Directory Service. Subsequent requests for this prop will bypass the provider and use the cache. <code>false</code> if the provider will be asked for this prop each time it is requested.</dd> -</dl> -<h6 id="Return_value" name="Return_value">Return value</h6> -<p>The <code><a href="/zh-CN/docs/Mozilla/Tech/XPCOM/Reference/Interface/nsIFile" title="">nsIFile</a></code> represented by the property.</p> -<h2 id="Example" name="Example">示例</h2> -<p>This code creates a global, read-only string called <code>currDir</code> with the value of the current working directory.</p> -<pre class="eval"> __defineGetter__("currDir", - function getCurrDir() { - return Components.classes["@mozilla.org/file/directory_service;1"] - .getService(Components.interfaces.nsIDirectoryServiceProvider) - .getFile("CurWorkD",{}).path; - }); -</pre> -<p>Test it with to see the magic happen.</p> -<pre class="eval"> alert(currDir); -</pre> -<h2 id="See_also" name="See_also">参见</h2> -<ul> - <li><a href="/en/nsDirectoryService" title="en/nsDirectoryService">nsDirectoryService</a></li> - <li><code><a href="/zh-CN/docs/Mozilla/Tech/XPCOM/Reference/Interface/nsIDirectoryService" title="">nsIDirectoryService</a></code></li> - <li>(译注)其它目录服务关键字见<a href="http://mxr.mozilla.org/mozilla-central/source/xpcom/io/nsDirectoryServiceDefs.h" title="http://mxr.mozilla.org/mozilla-central/source/xpcom/io/nsDirectoryServiceDefs.h">nsDirectoryServiceDefs.h</a></li> -</ul> -<p>Additionally, see <a class="external" href="http://mb.eschew.org/16.php#sub_16.5.2">section 16.5.2</a> of the <a class="external" href="http://mb.eschew.org/">Rapid Application Development with Mozilla</a> book for instructions on how to get the <strong>current working directory</strong> and the <strong>process binary directory</strong>, among other things.</p> |