Skip to content
This repository has been archived by the owner on Apr 25, 2023. It is now read-only.

Fix Windows inability to handle a tilde as the home directory #43

Merged
merged 3 commits into from
Nov 3, 2015

Conversation

tyrken
Copy link
Contributor

@tyrken tyrken commented Oct 16, 2015

The default location of the certificate files starting with a "~" (tilde) character causes Windows to barf. Follow some recommendations in http://stackoverflow.com/questions/17609732/expand-tilde-to-home-directory to fix.

Note that in my Windows/git-for-windows-2.5 environment some tests still fail (exec and volume mounting), but you can actually build the example Rockerfile. This also enables rocker-compose to work by default.

@@ -48,7 +50,8 @@ type Config struct {
func NewConfig() *Config {
certPath := os.Getenv("DOCKER_CERT_PATH")
if certPath == "" {
certPath = "~/.docker"
usr, _ := user.Current()

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is not cross platform API, the build can pass with CGO, but at runtime it will throw error on some platform.
see also: http://stackoverflow.com/questions/7922270/obtain-users-home-directory

@ybogdanov
Copy link
Contributor

@missedone thanks!

@tyrken can you try to incorporate https://github.com/mitchellh/go-homedir please? There are a few other places where it should be fixed, also there is rocker v1. So once you get it right with rocker/dockerclient I will copy/paste it to other places I remember.
Unfortunately, we don't have windows users to continuously test rocker while using it there.

@tyrken
Copy link
Contributor Author

tyrken commented Oct 16, 2015

I've switched from os/user to go-homedir as requested - hopefully easy to copy elsewhere. Sorry for the slightly messy git history!

ybogdanov pushed a commit that referenced this pull request Nov 3, 2015
Fix Windows inability to handle a tilde as the home directory
@ybogdanov ybogdanov merged commit 4de77e2 into grammarly:master Nov 3, 2015
@ybogdanov
Copy link
Contributor

Thanks, @tyrken!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants