Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

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

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build StatusCoverage StatusGo Report CardGoDoc

This library is based on and fully compatible withmitchellh/go-homedir but usesos/user because since go 1.9 there is no longer cgo compilation required.

Installation

go get -u github.com/atrox/homedir# or with depdep ensure -add github.com/atrox/homedir

Usage

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.

Example

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)}

Contributing

Everyone is encouraged to help improve this project. Here are a few ways you can help:

About

Go library for detecting and expanding the user's home directory

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages


[8]ページ先頭

©2009-2025 Movatter.jp