xpcom/tests/unit/head_xpcom.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/xpcom/tests/unit/head_xpcom.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,25 @@
     1.4 +var isWindows = ("@mozilla.org/windows-registry-key;1" in Components.classes);
     1.5 +
     1.6 +function get_test_program(prog)
     1.7 +{
     1.8 +  var progPath = do_get_cwd();
     1.9 +  progPath.append(prog);
    1.10 +  if (isWindows)
    1.11 +    progPath.leafName = progPath.leafName + ".exe";
    1.12 +  return progPath;
    1.13 +}
    1.14 +
    1.15 +function set_process_running_environment()
    1.16 +{
    1.17 +  var envSvc = Components.classes["@mozilla.org/process/environment;1"].
    1.18 +    getService(Components.interfaces.nsIEnvironment);
    1.19 +  var dirSvc = Components.classes["@mozilla.org/file/directory_service;1"].
    1.20 +    getService(Components.interfaces.nsIProperties);
    1.21 +  var greDir = dirSvc.get("GreD", Components.interfaces.nsIFile);
    1.22 +
    1.23 +  envSvc.set("DYLD_LIBRARY_PATH", greDir.path);
    1.24 +  // For Linux
    1.25 +  envSvc.set("LD_LIBRARY_PATH", greDir.path);
    1.26 +  //XXX: handle windows
    1.27 +}
    1.28 +

mercurial