appregistry

package
v0.0.0-...-10ffbd2 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2022 License: MIT Imports: 8 Imported by: 0

Documentation

Rendered for windows/amd64

Overview

Package appregistry accesses the list of unpackaged (aka "Classic" or "Desktop") applications in the Windows registry.

Example
package main

import (
	"fmt"

	"github.com/gentlemanautomaton/winapp/unpackaged/appregistry"
)

func main() {
	for _, view := range appregistry.Views {
		fmt.Printf("---- %s ----\n", view.Name())

		apps, err := view.List()
		if err != nil {
			fmt.Printf("Error: %v\n", err)
			continue
		}

		for _, app := range apps {
			line := string(app.ID)
			attrs := app.Attributes
			if name := attrs.GetString("DisplayName"); name != "" {
				line += ": " + name
			}
			if version := attrs.GetString("DisplayVersion"); version != "" {
				line += " [" + version + "]"
			}
			fmt.Printf("  %s\n", line)
		}
	}
}
Output:

Index

Examples

Constants

This section is empty.

Variables

View Source
var (
	// Global32 accesses the 32-bit global application registry.
	Global32 = global32

	// Global64 accesses the 64-bit global application registry.
	Global64 = global64

	// User32 accesses the 32-bit user application registry.
	User32 = user32

	// User64 accesses the 64-bit user application registry.
	User64 = user64
)

Views is a slice of all available application views.

Functions

This section is empty.

Types

type View

type View struct {
	// contains filtered or unexported fields
}

View provides a view of the global or user application registry, either 32-bit or 64-bit.

func (View) Add

func (v View) Add(app unpackaged.App) error

Add attempts to add the given unpackaged app to the Windows registry.

It returns an error if an application or component with the given ID already exists.

func (View) Get

func (v View) Get(id unpackaged.AppID) (unpackaged.App, error)

Add attempts to add the given application component to the Windows registry.

func (View) List

func (v View) List() (unpackaged.AppList, error)

Add attempts to add the given application component to the Windows registry.

It returns an error if a component with the given ID already exists.

func (View) Name

func (v View) Name() string

Name returns the name of the view.

func (View) Remove

func (v View) Remove(id unpackaged.AppID) error

Remove attempts to remove the given unpackaged app ID from the Windows registry.

It does _not_ run the component's uninstall command. It is the caller's responsibility to properly remove the component's files before removing it from the registry.

Jump to

Keyboard shortcuts

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