|
|
@ -74,9 +74,11 @@ func CreateRepositoryNotice(desc string) error { |
|
|
|
// creates a system notice when error occurs.
|
|
|
|
// creates a system notice when error occurs.
|
|
|
|
func RemoveAllWithNotice(title, path string) { |
|
|
|
func RemoveAllWithNotice(title, path string) { |
|
|
|
var err error |
|
|
|
var err error |
|
|
|
|
|
|
|
// 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 { |
|
|
|
if setting.IsWindows { |
|
|
|
// usually Go automatically converts "/" to "\" in path on Windows
|
|
|
|
// converting "/" to "\" in path on Windows
|
|
|
|
// but since we are running it manually, it's better to convert to prevent problems
|
|
|
|
|
|
|
|
path = strings.Replace(path, "/", "\\", -1) |
|
|
|
path = strings.Replace(path, "/", "\\", -1) |
|
|
|
err = exec.Command("cmd", "/C", "rmdir", "/S", "/Q", path).Run() |
|
|
|
err = exec.Command("cmd", "/C", "rmdir", "/S", "/Q", path).Run() |
|
|
|
} else { |
|
|
|
} else { |
|
|
|