Getting the home directory in jArchi

Started by Manj75, June 25, 2021, 17:47:41 PM

Previous topic - Next topic

Manj75

I need to be able to get the user homedirectory, i.e. %userprofile% for win32 and $home for mac, if this is possible.

I was pointed to the $.process but not sure if it supports .env for environment variable.  I want to do something like:

process.env[(process.platform == 'win32') ? 'USERPROFILE' : 'HOME'];


but, I get undefined for $.process.env, so possible that it is not supported.

projetnumero9

JB pointed out something similar in: https://forum.archimatetool.com/index.php?topic=854.msg4709#msg4709

The following should do the trick:

console.log("New Archi Script");
var System = Java.type('java.lang.System'); 
console.log(System.getProperty("user.home")); 
console.log(System.getenv("USERPROFILE")); 

Manj75