github.com/cloudbase/juju-core@v0.0.0-20140504232958-a7271ac7912f/juju/osenv/vars_windows.go (about) 1 // Copyright 2013 Canonical Ltd. 2 // Licensed under the AGPLv3, see LICENCE file for details. 3 4 package osenv 5 6 import ( 7 "os" 8 "path" 9 "path/filepath" 10 ) 11 12 var ( 13 TempDir = WinTempDir 14 LibDir = WinLibDir 15 LogDir = WinLogDir 16 DataDir = WinDataDir 17 JujuRun = path.Join(WinBinDir, "juju-run.exe") 18 SocketType = "tcp" 19 MustReboot = 1001 20 ) 21 22 // Home returns the os-specific home path as specified in the environment 23 func Home() string { 24 return path.Join(os.Getenv("HOMEDRIVE"), os.Getenv("HOMEPATH")) 25 } 26 27 // SetHome sets the os-specific home path in the environment 28 func SetHome(s string) error { 29 v := filepath.VolumeName(s) 30 if v != "" { 31 if err := os.Setenv("HOMEDRIVE", v); err != nil { 32 return err 33 } 34 } 35 return os.Setenv("HOMEPATH", s[len(v):]) 36 }