diff options
author | Unknown <joe2010xtmf@163.com> | 2014-03-28 17:34:07 -0400 |
---|---|---|
committer | Unknown <joe2010xtmf@163.com> | 2014-03-28 17:34:07 -0400 |
commit | a55941ff833155cba88dbcc957b15c0ddcf07cb4 (patch) | |
tree | dd892998bfb0b25eeb2b6f1d0ea8c8b9a69bf422 /modules/base/conf.go | |
parent | 9047cadcd33f95eebafa2f794b895c8406eb80c5 (diff) | |
download | gitea-a55941ff833155cba88dbcc957b15c0ddcf07cb4.tar.gz gitea-a55941ff833155cba88dbcc957b15c0ddcf07cb4.zip |
Add auto-detect home directory
Diffstat (limited to 'modules/base/conf.go')
-rw-r--r-- | modules/base/conf.go | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/modules/base/conf.go b/modules/base/conf.go index b3a987e646..fd77cfd3ce 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) } } |