"use strict";
var os = require("os");

/**
Cross-platform home directory retriever, tested on Windows XP, Windows 8.1, Mac OSX, Linux. Will use the built-in [`os.homedir`](https://nodejs.org/api/os.html#os_os_homedir) if available.
@module home-path
*/
module.exports = os.homedir ? os.homedir : getHomePath;

/**
@alias module:home-path
@example
Mac OSX & Linux
```js
> var getHomePath = require("home-path");
> getHomePath()
'/Users/Lloyd'
```

Windows 8.1
```js
> var getHomePath = require("home-path");
> getHomePath()
'C:\\Users\\Lloyd'
```
*/
function getHomePath() {
	if (process.platform === "win32") {
		return process.env.USERPROFILE || process.env.HOMEDRIVE + process.env.HOMEPATH || process.env.HOME;
	} else {
	    return process.env.HOME
	}
};
