]> source.dussan.org Git - gitea.git/commitdiff
Bug fix
authorUnknown <joe2010xtmf@163.com>
Wed, 12 Mar 2014 02:38:33 +0000 (22:38 -0400)
committerUnknown <joe2010xtmf@163.com>
Wed, 12 Mar 2014 02:38:33 +0000 (22:38 -0400)
models/models.go

index ce95c12565fe80a3631d644be1b153276b8b2909..413775f58bd6c78397329e856cedebf36daef1d0 100644 (file)
@@ -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() {