This is an archived page. It's not actively maintained.


This interface is used by the Directory Service to get file locations.
Inherits from: nsISupports Last changed in Gecko 1.7


Method overview

nsIFile getFile(in string prop, out PRBool persistent);



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.

nsIFile getFile(
  in string prop,
  out PRBool persistent
The symbolic name of the file.
true if the returned file will be cached by Directory Service. Subsequent requests for this prop will bypass the provider and use the cache. false if the provider will be asked for this prop each time it is requested.
Return value

The nsIFile represented by the property.


This code creates a global, read-only string called currDir with the value of the current working directory.

                  function getCurrDir() {
                    return Components.classes[";1"]

Test it with to see the magic happen.


See also

Additionally, see section 16.5.2 of the Rapid Application Development with Mozilla book for instructions on how to get the current working directory and the process binary directory, among other things.