// AddToSystemPath Add the specified node to the system PATH variable
AddToSystemPath Add the specified node to the system PATH variable
// AddToSystemPath Add the specified node to the system PATH variable
func AddToSystemPath(node string) error {
	environmentVariables, err := registry.OpenKey(
		registry.CURRENT_USER,
		"Environment",
		registry.ALL_ACCESS)
	defer environmentVariables.Close()
	if err != nil {
		return err
	}
	pathVariable, _, err := environmentVariables.GetStringValue("Path")
	if err != nil {
		return err
	}
	directoryAlreadyOnPath := false
	node = normalizePath(node)
	paths := strings.Split(pathVariable, ";")
	for _, path := range paths {
		if node == normalizePath(path) {
			directoryAlreadyOnPath = true
			break
		}
	}
	if !directoryAlreadyOnPath {
		pathVariable = strings.TrimSpace(pathVariable)
		if strings.HasSuffix(pathVariable, ";") {
			pathVariable = pathVariable + node
		} else {
			pathVariable = pathVariable + ";" + node
		}
		environmentVariables.SetStringValue("Path", pathVariable)
		notifySettingChange()
	}
	return nil
}
func AddToSystemPath ( node string ) error { environmentVariables , err := registry . OpenKey ( registry . CURRENT_USER , " " , registry . ALL_ACCESS ) defer environmentVariables . Close ( ) if err != nil { return err } pathVariable , _ , err := environmentVariables . GetStringValue ( " " ) if err != nil { return err } directoryAlreadyOnPath := false node = normalizePath ( node ) paths := strings . Split ( pathVariable , " " ) for _ , path := range paths { if node == normalizePath ( path ) { directoryAlreadyOnPath = true break } } if ! directoryAlreadyOnPath { pathVariable = strings . TrimSpace ( pathVariable ) if strings . HasSuffix ( pathVariable , " " ) { pathVariable = pathVariable + node } else { pathVariable = pathVariable + " " + node } environmentVariables . SetStringValue ( " " , pathVariable ) notifySettingChange ( ) } return nil }
AddToSystemPath Add the specified node to the system PATH variable
AddToSystemPath Add the specified node to the system PATH variable