mirror of
https://github.com/containers/podman.git
synced 2025-06-24 11:20:12 +08:00
Windows uses USERPROFILE not HOME
When dealing with environment variables that set $HOME, we do not get the desired result. Windows will honor USERPROFILE. [NO NEW TESTS NEEDED] Signed-off-by: Brent Baude <bbaude@redhat.com>
This commit is contained in:
@ -147,6 +147,11 @@ func setup() (string, *machineTestBuilder) {
|
|||||||
if err := os.Setenv("HOME", homeDir); err != nil {
|
if err := os.Setenv("HOME", homeDir); err != nil {
|
||||||
Fail("failed to set home dir")
|
Fail("failed to set home dir")
|
||||||
}
|
}
|
||||||
|
if runtime.GOOS == "windows" {
|
||||||
|
if err := os.Setenv("USERPROFILE", homeDir); err != nil {
|
||||||
|
Fail("unable to set home dir on windows")
|
||||||
|
}
|
||||||
|
}
|
||||||
if err := os.Setenv("XDG_RUNTIME_DIR", homeDir); err != nil {
|
if err := os.Setenv("XDG_RUNTIME_DIR", homeDir); err != nil {
|
||||||
Fail("failed to set xdg_runtime dir")
|
Fail("failed to set xdg_runtime dir")
|
||||||
}
|
}
|
||||||
@ -203,4 +208,9 @@ func teardown(origHomeDir string, testDir string, mb *machineTestBuilder) {
|
|||||||
if err := os.Setenv("HOME", origHomeDir); err != nil {
|
if err := os.Setenv("HOME", origHomeDir); err != nil {
|
||||||
Fail("failed to set home dir")
|
Fail("failed to set home dir")
|
||||||
}
|
}
|
||||||
|
if runtime.GOOS == "windows" {
|
||||||
|
if err := os.Setenv("USERPROFILE", origHomeDir); err != nil {
|
||||||
|
Fail("failed to set windows home dir back to original")
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user