Fork to maintain patches against the official gitea for https://code.ceondo.com https://github.com/go-gitea/gitea

remove_windows.go 701B

1234567891011121314151617
  1. // +build windows,!go1.7
  2. // Copyright 2017 The Gitea Authors. All rights reserved.
  3. // Use of this source code is governed by a MIT-style
  4. // license that can be found in the LICENSE file.
  5. package util
  6. // RemoveAll files from path on windows
  7. // workaround for Go not being able to remove read-only files/folders: https://github.com/golang/go/issues/9606
  8. // this bug should be fixed on Go 1.7, so the workaround should be removed when Gitea don't support Go 1.6 anymore:
  9. // https://github.com/golang/go/commit/2ffb3e5d905b5622204d199128dec06cefd57790
  10. func RemoveAll(path string) error {
  11. path = strings.Replace(path, "/", "\\", -1)
  12. return exec.Command("cmd", "/C", "rmdir", "/S", "/Q", path).Run()
  13. }