summaryrefslogtreecommitdiffstats
path: root/routers/install.go
diff options
context:
space:
mode:
authorJosh Frye <joshfng@gmail.com>2016-02-12 10:03:04 -0500
committerJosh Frye <joshfng@gmail.com>2016-02-12 10:03:04 -0500
commitec478b4b063e767eaf804216d2273d6e1f48d882 (patch)
treeffd24515181b32733f452513cda27e99dcea3bff /routers/install.go
parent1feecd6beb19ac993afdc36f31207193ca42c553 (diff)
downloadgitea-ec478b4b063e767eaf804216d2273d6e1f48d882.tar.gz
gitea-ec478b4b063e767eaf804216d2273d6e1f48d882.zip
Set default log path if empty during install
Diffstat (limited to 'routers/install.go')
-rw-r--r--routers/install.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/routers/install.go b/routers/install.go
index b8b7dec1e7..668912960c 100644
--- a/routers/install.go
+++ b/routers/install.go
@@ -242,6 +242,16 @@ func InstallPost(ctx *middleware.Context, form auth.InstallForm) {
return
}
+ // Set default log path if empty.
+ workDir, err := setting.WorkDir()
+ if err != nil {
+ log.Fatal(4, "Fail to get work directory: %v", err)
+ }
+
+ if len(form.LogRootPath) == 0 {
+ form.LogRootPath = path.Join(workDir, "log")
+ }
+
// Test log root path.
form.LogRootPath = strings.Replace(form.LogRootPath, "\\", "/", -1)
if err := os.MkdirAll(form.LogRootPath, os.ModePerm); err != nil {