Add auto-detect home directory
This commit is contained in:
parent
9047cadcd3
commit
a55941ff83
5 changed files with 25 additions and 18 deletions
|
@ -291,9 +291,14 @@ func NewConfigContext() {
|
|||
PictureService = Cfg.MustValue("picture", "SERVICE")
|
||||
|
||||
// Determine and create root git reposiroty path.
|
||||
RepoRootPath = Cfg.MustValue("repository", "ROOT")
|
||||
homeDir, err := com.HomeDir()
|
||||
if err != nil {
|
||||
fmt.Printf("Fail to get home directory): %v\n", err)
|
||||
os.Exit(2)
|
||||
}
|
||||
RepoRootPath = Cfg.MustValue("repository", "ROOT", filepath.Join(homeDir, "git/gogs-repositories"))
|
||||
if err = os.MkdirAll(RepoRootPath, os.ModePerm); err != nil {
|
||||
fmt.Printf("models.init(fail to create RepoRootPath(%s)): %v\n", RepoRootPath, err)
|
||||
fmt.Printf("Fail to create RepoRootPath(%s): %v\n", RepoRootPath, err)
|
||||
os.Exit(2)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue