- Notifications
You must be signed in to change notification settings - Fork0
Go library for detecting and expanding the user's home directory
License
NotificationsYou must be signed in to change notification settings
Atrox/homedir
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
This library is based on and fully compatible withmitchellh/go-homedir but uses
os/user
because since go 1.9 there is no longer cgo compilation required.
go get -u github.com/atrox/homedir# or with depdep ensure -add github.com/atrox/homedir
Usage is incredibly simple, just callhomedir.Dir()
to get the home directoryfor a user, andhomedir.Expand(path string)
to expand the~
in a path to the homedirectory.
package mainimport ("fmt""github.com/atrox/homedir")funcmain() {dir,err:=homedir.Dir()iferr!=nil {panic(err) }fmt.Printf("'%s' is your users home directory\n",dir)path,err:=homedir.Expand("~/.config")iferr!=nil {panic(err) }fmt.Printf("'%s' is the expanded path to the .config directory\n",path)}
Everyone is encouraged to help improve this project. Here are a few ways you can help:
- Report bugs
- Fix bugs andsubmit pull requests
- Write, clarify, or fix documentation
- Suggest or add new features
About
Go library for detecting and expanding the user's home directory
Topics
Resources
License
Stars
Watchers
Forks
Packages0
No packages published