conformal/btcd — pull request #194 by davecgh (2014-12-21 22:01:54+00:00)
Title: Improve handling of the home directory creation.

This pull request improves a couple of issues surrounding the creation of the btcd home directory.

First, the code was previously attempting to log any errors that occurred while creating the directory using the logging system which is not initialized at that point. Thus, nothing was displayed to the user.

Second, if any component of btcd home directory path already exist, but are not a directory, such as in the case of symlinks, the error returned from the os.MkDirAll call indicates the directory can't be created. While this is true, it's not always the most helpful error to display to the user. So, this commit adds logic to detect when the failure case is due to an existing symlink and displays a nicer error message suggesting the user check if the destination of the link is mounted.

Example error:

> $ ./btcd
> loadConfig: failed to create btcd home directory: is symlink /home/davec/.btcd -> /mnt/dot-btcd/ not mounted?