Checks whether process.env.HOME exists

Checks whether process.env.HOME exists before calling Path.join
Was not able to start sinopia on my fresh windows install due to this error.
Agree. You don't need the null in the end as well.


On Fri, Dec 19, 2014 at 9:04 PM, Alex Vernacchia <notifications@github.com>
wrote:

> In lib/config-path.js
> <https://github.com/rlidwka/sinopia/pull/182#discussion-diff-22109974>:
>
> > @@ -35,16 +35,16 @@ function create_config_file(config_path) {
> >
> >  function get_paths() {
> >    var try_paths = []
> > -
> > -  var xdg_config = process.env.XDG_CONFIG_HOME
> > -                || Path.join(process.env.HOME, '.config')
> > -  if (folder_exists(xdg_config)) {
> > -    try_paths.push({
> > -      path: Path.join(xdg_config, 'sinopia', 'config.yaml'),
> > -      type: 'xdg',
> > -    })
> > +  if(typeof process.env.HOME == "string"){
>
> Wouldn't an easier way be below? You wouldn't even really need the || null
> at the end since the try statement in the folder_exists function would
> catch the "emptyness"
>
> var xdg_config = process.env.XDG_CONFIG_HOME
>     || process.env.HOME && Path.join(process.env.HOME, '.config')
>     || null
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/rlidwka/sinopia/pull/182/files#r22109974>.
>