Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add github.com/mitchellh/go-homedir #2

Merged
merged 1 commit into from
Oct 23, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions clients/vmClient/vmClient.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,13 @@ import (
"io"
"io/ioutil"
"os"
"os/user"
"path"
"strings"
"time"
"unicode"

homedir "github.com/mitchellh/go-homedir"

azure "github.com/MSOpenTech/azure-sdk-for-go"
"github.com/MSOpenTech/azure-sdk-for-go/clients/imageClient"
"github.com/MSOpenTech/azure-sdk-for-go/clients/locationClient"
Expand Down Expand Up @@ -557,12 +558,12 @@ func createDockerPublicConfig(dockerPort int) string {
}

func createDockerPrivateConfig(dockerCertDir string) (string, error) {
usr, err := user.Current()
homeDir, err := homedir.Dir()
if err != nil {
return "", err
}

certDir := path.Join(usr.HomeDir, dockerCertDir)
certDir := path.Join(homeDir, dockerCertDir)

if _, err := os.Stat(certDir); err == nil {
fmt.Println(dockerDirExistsMessage)
Expand Down
7 changes: 4 additions & 3 deletions publishSettings.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ import (
"fmt"
"io/ioutil"
"os"
"os/user"
"path"

homedir "github.com/mitchellh/go-homedir"
)

var settings publishSettings = publishSettings{}
Expand Down Expand Up @@ -140,12 +141,12 @@ func getActiveSubscription(publishSettingsContent []byte) (subscription, error)
}

func getAzureDir() (string, error) {
usr, err := user.Current()
homeDir, err := homedir.Dir()
if err != nil {
return "", err
}

azureDir := path.Join(usr.HomeDir, ".azure")
azureDir := path.Join(homeDir, ".azure")
//Create azure dir if does not exists
if _, err := os.Stat(azureDir); os.IsNotExist(err) {
mkdirErr := os.Mkdir(azureDir, 0644)
Expand Down