All Projects → ProtonMail → go-appdir

ProtonMail / go-appdir

Licence: MIT license
Minimalistic Go package to get application directories such as config and cache

Programming Languages

go
31211 projects - #10 most used programming language

Projects that are alternatives of or similar to go-appdir

unconfig
A universal solution for loading configurations.
Stars: ✭ 415 (+569.35%)
Mutual labels:  config
electron-json-config
Simply set and get configuration from a json file for your Electron app
Stars: ✭ 25 (-59.68%)
Mutual labels:  config
MatrixChecks
The optimized checks for Matrix Anticheat, a powerful anticheat for Minecraft.
Stars: ✭ 70 (+12.9%)
Mutual labels:  config
Tieba-Birthday-Spider
百度贴吧生日爬虫,可抓取贴吧内吧友生日,并且在对应日期自动发送祝福
Stars: ✭ 28 (-54.84%)
Mutual labels:  config
nvim
❤️ A neovim config repo.
Stars: ✭ 33 (-46.77%)
Mutual labels:  config
croconf
A flexible and composable configuration library for Go that doesn't suck
Stars: ✭ 14 (-77.42%)
Mutual labels:  config
stumpwm-config
My configuration files for StumpWM
Stars: ✭ 62 (+0%)
Mutual labels:  config
neovimfiles
My Neovim configuration written in Lua
Stars: ✭ 52 (-16.13%)
Mutual labels:  config
kerrigan
基于Tornado实现的一套配置中心,可基于分项目、环境管理配置,语法高亮、对比历史版本、快速回滚等,并提供Restful风格的API
Stars: ✭ 57 (-8.06%)
Mutual labels:  config
dotfiles
My dot files and dev environment using bash, tmux and vim
Stars: ✭ 61 (-1.61%)
Mutual labels:  config
ApexConfigs
Apex Legends configs for a competitve player
Stars: ✭ 52 (-16.13%)
Mutual labels:  config
php-nacos
阿里巴巴nacos配置中心-PHP客户端
Stars: ✭ 167 (+169.35%)
Mutual labels:  config
dotfiles
🏠 ~/
Stars: ✭ 19 (-69.35%)
Mutual labels:  config
redconf
sync config from redis or others storage while the config values changed
Stars: ✭ 12 (-80.65%)
Mutual labels:  config
MSI-Modern15-Hackintosh
My MSI Modern 15 Hackintosh repo
Stars: ✭ 16 (-74.19%)
Mutual labels:  config
d-l-l
Simplified DLL config creator & handler
Stars: ✭ 27 (-56.45%)
Mutual labels:  config
i3
Archivos de configuraciones de i3
Stars: ✭ 32 (-48.39%)
Mutual labels:  config
cfg-rs
A Configuration Library for Rust Applications
Stars: ✭ 18 (-70.97%)
Mutual labels:  config
StarCategorizer
assign steamshop genres to your steam library games, even on private profiles
Stars: ✭ 18 (-70.97%)
Mutual labels:  config
libconfigini
Configuration parser library in INI format
Stars: ✭ 32 (-48.39%)
Mutual labels:  config

go-appdir

GoDoc

Minimalistic Go package to get application directories such as config and cache.

Platform Windows Linux/BSDs macOS
User-specific config %APPDATA% (C:\Users\%USERNAME%\AppData\Roaming) $XDG_CONFIG_HOME ($HOME/.config) $HOME/Library/Application Support
User-specific cache %LOCALAPPDATA% (C:\Users\%USERNAME%\AppData\Local) $XDG_CACHE_HOME ($HOME/.cache) $HOME/Library/Caches
User-specific data %LOCALAPPDATA% (C:\Users\%USERNAME%\AppData\Local) $XDG_DATA_HOME ($HOME/.local/share) $HOME/Library/Application Support
User-specific logs %LOCALAPPDATA% (C:\Users\%USERNAME%\AppData\Local) $XDG_CACHE_HOME/<name>/logs $HOME/Library/Logs

Inspired by configdir.

Usage

package main

import (
	"os"
	"path/filepath"

	"github.com/ProtonMail/go-appdir"
)

func main() {
	// Get directories for our app
	dirs := appdir.New("my-awesome-app")

	// Get user-specific config dir
	p := dirs.UserConfig()

	// Create our app config dir
	if err := os.MkdirAll(p, 0755); err != nil {
		panic(err)
	}

	// Now we can use it
	f, err := os.Create(filepath.Join(p, "config-file"))
	if err != nil {
		panic(err)
	}
	defer f.Close()

	f.Write([]byte("<3"))
}

License

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].