summaryrefslogtreecommitdiffstats
path: root/models/models.go
diff options
context:
space:
mode:
authorUnknown <joe2010xtmf@163.com>2014-03-11 22:38:33 -0400
committerUnknown <joe2010xtmf@163.com>2014-03-11 22:38:33 -0400
commitcaf05599df34c2d1b1e436bb1611b2cf902371c0 (patch)
tree10e197bff8e0d24d6da562acb68a0aca72da2355 /models/models.go
parent0b5f6b176feaacd33ec2dd4eff1fff6dc67d7376 (diff)
downloadgitea-caf05599df34c2d1b1e436bb1611b2cf902371c0.tar.gz
gitea-caf05599df34c2d1b1e436bb1611b2cf902371c0.zip
Bug fix
Diffstat (limited to 'models/models.go')
-rw-r--r--models/models.go17
1 files changed, 17 insertions, 0 deletions
diff --git a/models/models.go b/models/models.go
index ce95c12565..413775f58b 100644
--- a/models/models.go
+++ b/models/models.go
@@ -7,7 +7,9 @@ package models
import (
"fmt"
"os"
+ "path/filepath"
+ "github.com/Unknwon/com"
_ "github.com/go-sql-driver/mysql"
"github.com/lunny/xorm"
@@ -71,6 +73,21 @@ func setEngine() {
orm.ShowSQL = true
RepoRootPath = base.Cfg.MustValue("repository", "ROOT")
+ if err = os.MkdirAll(RepoRootPath, os.ModePerm); err != nil {
+ fmt.Printf("models.init -> fail to create RepoRootPath(%s): %v\n", RepoRootPath, err)
+ os.Exit(2)
+ }
+
+ homeDir, err := com.HomeDir()
+ if err != nil {
+ fmt.Printf("models.init -> fail to get homeDir: %v\n", err)
+ os.Exit(2)
+ }
+ sshPath := filepath.Join(homeDir, ".ssh")
+ if err = os.MkdirAll(sshPath, os.ModePerm); err != nil {
+ fmt.Printf("models.init -> fail to create sshPath(%s): %v\n", sshPath, err)
+ os.Exit(2)
+ }
}
func init() {