2012-03-12 19:50:04 -06:00
|
|
|
// Copyright 2012 The Go Authors. All rights reserved.
|
|
|
|
// Use of this source code is governed by a BSD-style
|
|
|
|
// license that can be found in the LICENSE file.
|
|
|
|
|
|
|
|
package os
|
|
|
|
|
|
|
|
import "syscall"
|
|
|
|
|
2012-03-12 23:48:07 -06:00
|
|
|
func isExist(err error) bool {
|
2016-09-10 07:34:07 -06:00
|
|
|
err = underlyingError(err)
|
2012-03-14 09:54:40 -06:00
|
|
|
return err == syscall.ERROR_ALREADY_EXISTS ||
|
2016-09-24 17:39:36 -06:00
|
|
|
err == syscall.ERROR_DIR_NOT_EMPTY ||
|
2012-03-12 19:50:04 -06:00
|
|
|
err == syscall.ERROR_FILE_EXISTS || err == ErrExist
|
|
|
|
}
|
|
|
|
|
2015-09-15 00:59:20 -06:00
|
|
|
const _ERROR_BAD_NETPATH = syscall.Errno(53)
|
|
|
|
|
2012-03-12 23:48:07 -06:00
|
|
|
func isNotExist(err error) bool {
|
2016-09-10 07:34:07 -06:00
|
|
|
err = underlyingError(err)
|
2012-03-14 09:54:40 -06:00
|
|
|
return err == syscall.ERROR_FILE_NOT_FOUND ||
|
2015-09-15 00:59:20 -06:00
|
|
|
err == _ERROR_BAD_NETPATH ||
|
2012-03-14 09:54:40 -06:00
|
|
|
err == syscall.ERROR_PATH_NOT_FOUND || err == ErrNotExist
|
2012-03-12 19:50:04 -06:00
|
|
|
}
|
|
|
|
|
2012-03-12 23:48:07 -06:00
|
|
|
func isPermission(err error) bool {
|
2016-09-10 07:34:07 -06:00
|
|
|
err = underlyingError(err)
|
2012-04-09 18:07:29 -06:00
|
|
|
return err == syscall.ERROR_ACCESS_DENIED || err == ErrPermission
|
2012-03-12 19:50:04 -06:00
|
|
|
}
|