Fix msysGit Portable $HOME location

The command used to launch git bash is: C:\Windows\SysWOW64\cmd.exe /c “”C:\Prog\Git\1.7.1\bin\sh.exe” –login -i” I just tried the following in a DOS session: C:\>C:\Windows\SysWOW64\cmd.exe /c “”C:\Prog\Git\1.7.1\bin\sh.exe” –login -i” VonC@XXX /c/ $ echo $HOME /c/Users/VonC By default, $HOME$%HOMEPATH%, but if I force %HOME%: set HOME=/another/path and then launch the same bash session: C:\>C:\Windows\SysWOW64\cmd.exe /c “”C:\Prog\Git\1.7.1\bin\sh.exe” –login -i” … Read more

Node.js – Find home directory in platform agnostic way

As mentioned in a more recent answer, the preferred way is now simply: const homedir = require(‘os’).homedir(); [Original Answer] Why not use the USERPROFILE environment variable on win32? function getUserHome() { return process.env[(process.platform == ‘win32’) ? ‘USERPROFILE’ : ‘HOME’]; }

How to find the real user home directory using python?

I think os.path.expanduser(path) could be helpful. On Unix and Windows, return the argument with an initial component of ~ or ~user replaced by that user‘s home directory. On Unix, an initial ~ is replaced by the environment variable HOME if it is set; otherwise the current user’s home directory is looked up in the password … Read more

What is the best way to find the user’s home directory in Java?

The bug you reference (bug 4787391) has been fixed in Java 8. Even if you are using an older version of Java, the System.getProperty(“user.home”) approach is probably still the best. The user.home approach seems to work in a very large number of cases. A 100% bulletproof solution on Windows is hard, because Windows has a … Read more