You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

16 lines
701 B

  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. }