summaryrefslogtreecommitdiffstats
path: root/xpcom/tests/unit/test_home.js
blob: e3a4af97969a083db51dd3e4e1044ac4c03bc95f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
const CWD = do_get_cwd();
function checkOS(os) {
  const nsILocalFile_ = "nsILocalFile" + os;
  return nsILocalFile_ in Ci && CWD instanceof Ci[nsILocalFile_];
}

const isWin = checkOS("Win");

function run_test() {
  var envVar = isWin ? "USERPROFILE" : "HOME";

  var homeDir = Services.dirsvc.get("Home", Ci.nsIFile);

  var expected = Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsIFile);
  expected.initWithPath(Services.env.get(envVar));

  Assert.equal(homeDir.path, expected.path);
}