aboutsummaryrefslogtreecommitdiff
path: root/models/admin.go
diff options
context:
space:
mode:
authorUnknwon <u@gogs.io>2017-01-30 13:30:04 -0500
committerUnknwon <u@gogs.io>2017-01-30 13:30:04 -0500
commit185c90df1259ce1bbfd10c0d053a938020b9ff90 (patch)
tree4ccc6ce96ec7a84ab746aa296b92afc5322d9870 /models/admin.go
parent7463d9c51dca6740af0cbb6c7cbeee17a99ecdf6 (diff)
Skip deletion for temporary data when not exist on Windows (#4069)
Diffstat (limited to 'models/admin.go')
-rw-r--r--models/admin.go3
1 files changed, 2 insertions, 1 deletions
diff --git a/models/admin.go b/models/admin.go
index 68731a24..c9a13eb5 100644
--- a/models/admin.go
+++ b/models/admin.go
@@ -77,7 +77,8 @@ func RemoveAllWithNotice(title, path string) {
// workaround for Go not being able to remove read-only files/folders: https://github.com/golang/go/issues/9606
// this bug should be fixed on Go 1.7, so the workaround should be removed when Gogs don't support Go 1.6 anymore:
// https://github.com/golang/go/commit/2ffb3e5d905b5622204d199128dec06cefd57790
- if setting.IsWindows {
+ // Note: Windows complains when delete target does not exist, therefore we can skip deletion in such cases.
+ if setting.IsWindows && com.IsExist(path) {
// converting "/" to "\" in path on Windows
path = strings.Replace(path, "/", "\\", -1)
err = exec.Command("cmd", "/C", "rmdir", "/S", "/Q", path).Run()