mirror of
				https://gitee.com/gitea/gitea
				synced 2025-11-04 16:40:24 +08:00 
			
		
		
		
	Set default log path if empty during install
This commit is contained in:
		@@ -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 {
 | 
			
		||||
 
 | 
			
		||||
@@ -109,9 +109,9 @@
 | 
			
		||||
						<input id="app_url" name="app_url" value="{{.app_url}}" placeholder="e.g. https://try.gogs.io" required>
 | 
			
		||||
						<span class="help">{{.i18n.Tr "install.app_url_helper"}}</span>
 | 
			
		||||
					</div>
 | 
			
		||||
					<div class="inline required field">
 | 
			
		||||
					<div class="inline field">
 | 
			
		||||
						<label for="log_root_path">{{.i18n.Tr "install.log_root_path"}}</label>
 | 
			
		||||
						<input id="log_root_path" name="log_root_path" value="{{.log_root_path}}" placeholder="log" required>
 | 
			
		||||
						<input id="log_root_path" name="log_root_path" value="{{.log_root_path}}" placeholder="log">
 | 
			
		||||
						<span class="help">{{.i18n.Tr "install.log_root_path_helper"}}</span>
 | 
			
		||||
					</div>
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user