appdir

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2026 License: MIT Imports: 3 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package appdir discovers application home directory. 应用程序主目录发现。

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoCandidates = errors.New("appdir: no candidates available")
	ErrNotFound     = errors.New("appdir: cannot discover home directory")
)

Functions

func DiscoverHome

func DiscoverHome(opts Options) (string, error)

DiscoverHome finds the first candidate directory containing marker files. DiscoverHome 查找第一个包含标记文件的候选目录。

Example / 示例:

home, _ := appdir.DiscoverHome(appdir.Options{EnvVar: "APP_HOME", Markers: []string{"configs"}})

Types

type Options

type Options struct {
	EnvVar            string
	Markers           []string
	RequireDirMarkers bool
}

Options configures home directory discovery. Options 配置主目录发现。

Jump to

Keyboard shortcuts

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