Merge pull request #7166 from hashicorp/fix_7160

windows plugin: prioritize AppData over default user directory ( UserProfile )
This commit is contained in:
Megan Marsh 2019-01-04 09:31:53 -08:00 committed by GitHub
commit 532dd5fed9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 4 deletions

View File

@ -44,12 +44,17 @@ func ConfigTmpDir() (string, error) {
func homeDir() (string, error) {
// First prefer the HOME environmental variable
// Prefer $HOME over user.Current due to glibc bug: golang.org/issue/13470
if home := os.Getenv("HOME"); home != "" {
log.Printf("Detected home directory from env var: %s", home)
return home, nil
}
if home := os.Getenv("APPDATA"); home != "" {
log.Printf("Detected home directory from env var: %s", home)
return home, nil
}
// Fall back to the passwd database if not found which follows
// the same semantics as bourne shell
u, err := user.Current()

View File

@ -52,10 +52,13 @@ later, it will take precedence over one found earlier.
1. The directory where `packer` is, or the executable directory.
2. `~/.packer.d/plugins` on Unix systems or `%APPDATA%/packer.d/plugins` on
Windows.
2. The `$HOME/packer.d/plugins` directory, if `$HOME` is defined (unix)
3. The current working directory.
3. The `%APPDATA%/packer.d/plugins` if `%APPDATA%` is defined (windows)
4. The `%USERPROFILE%/packer.d/plugins` if `%USERPROFILE%` is defined (windows)
4. The current working directory.
The valid types for plugins are: