From a55941ff833155cba88dbcc957b15c0ddcf07cb4 Mon Sep 17 00:00:00 2001 From: Unknown Date: Fri, 28 Mar 2014 17:34:07 -0400 Subject: Add auto-detect home directory --- modules/base/conf.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'modules/base') diff --git a/modules/base/conf.go b/modules/base/conf.go index b3a987e6..fd77cfd3 100644 --- a/modules/base/conf.go +++ b/modules/base/conf.go @@ -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) } } -- cgit v1.2.3