在xul中,如何检索环境变量? [英] In xul, how to retrieve an environment variable?

查看:131
本文介绍了在xul中,如何检索环境变量?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个名为 $ REP 的环境,如何在Linux环境中使用Xulrunner访问此变量的值?

I have an environment called $REP, how can I access the value of this variable using Xulrunner in a Linux environment?

- udpate

尝试使用 nslEnvironment

var env = Components.classes["@mozilla.org/process/environment;1"].getService(Components.interfaces.nsIEnvironment);
dump("bash=" + env.exists("BASH") + '\n');
dump("bash=" + env.exists("$BASH") + '\n');

输出为:

bash=false
bash=false

它应该在终端中输出/ bin / bash。我也尝试使用 get 查看是否只是存在方法错误,但它返回为空。

as you imagine, it should output "/bin/bash" as it does in the terminal. I also tried using get to see if it was just the exists method wrong, but it returned empty.

这里有什么问题?

推荐答案

使用 nsIEnvironment 读取(和设置)环境变量。

Use nsIEnvironment to read (and set) environment variables.

这篇关于在xul中,如何检索环境变量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆