pathing

package
v0.5.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 16, 2024 License: MPL-2.0 Imports: 6 Imported by: 9

Documentation

Overview

Package pathing determines where to put the Packer config directory based on host OS architecture and user environment variables.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConfigDir

func ConfigDir() (string, error)

ConfigDir returns the configuration directory for Packer. NOTE: config directory will change depending on operating system dependent For Windows:

PACKER_CONFIG_DIR=""           ConfigDir() => "/{homeDir()}/packer.config/
PACKER_CONFIG_DIR="bar"        ConfigDir() => "/bar/packer.config/

NOTE: Default_config_present=TRUE means that there is configuration directory at old location => $HOME/.packer.d NOTE: This is not list all permutations, just some examples, view the configDir function for your OS for the exact logic For Unix:

PACKER_CONFIG_DIR=""    Default_config_present=FALSE XDG_CONFIG_HOME=""    ConfigDir() => "$HOME/.config/packer
PACKER_CONFIG_DIR="bar" Default_config_present=FALSE	XDG_CONFIG_HOME=""    ConfigDir() => "/bar/.packer.d/
PACKER_CONFIG_DIR=""    Default_config_present=TRUE 	XDG_CONFIG_HOME=""    ConfigDir() => "/$HOME/.packer.d/
PACKER_CONFIG_DIR=""    Default_config_present=TRUE 	XDG_CONFIG_HOME="bar" ConfigDir() => "/bar/.packer.d/

func ConfigFile

func ConfigFile() (string, error)

ConfigFile returns the default path to the configuration file. On Unix-like systems this is the ".packerconfig" file in the home directory. On Windows, this is the "packer.config" file in the application data directory.

func ExpandUser

func ExpandUser(path string) (string, error)

Given a path, check to see if it's using ~ to reference a user directory. If so, then replace that component with the requested user directory. In "~/", "~" gets replaced by current user's home dir. In "~root/", "~user" gets replaced by root's home dir. ~ has to be the first character of path for ExpandUser change it.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL