2012-03-30 23:27:11 +02: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-31 00:09:55 +02:00
|
|
|
func isExist(err error) bool {
|
2017-01-14 01:05:42 +01:00
|
|
|
err = underlyingError(err)
|
2012-03-31 00:09:55 +02:00
|
|
|
return err == syscall.ERROR_ALREADY_EXISTS ||
|
2017-01-14 01:05:42 +01:00
|
|
|
err == syscall.ERROR_DIR_NOT_EMPTY ||
|
2012-03-30 23:27:11 +02:00
|
|
|
err == syscall.ERROR_FILE_EXISTS || err == ErrExist
|
|
|
|
}
|
|
|
|
|
2016-02-03 22:58:02 +01:00
|
|
|
const _ERROR_BAD_NETPATH = syscall.Errno(53)
|
|
|
|
|
2012-03-31 00:09:55 +02:00
|
|
|
func isNotExist(err error) bool {
|
2017-01-14 01:05:42 +01:00
|
|
|
err = underlyingError(err)
|
2012-03-31 00:09:55 +02:00
|
|
|
return err == syscall.ERROR_FILE_NOT_FOUND ||
|
2016-02-03 22:58:02 +01:00
|
|
|
err == _ERROR_BAD_NETPATH ||
|
2012-03-31 00:09:55 +02:00
|
|
|
err == syscall.ERROR_PATH_NOT_FOUND || err == ErrNotExist
|
2012-03-30 23:27:11 +02:00
|
|
|
}
|
|
|
|
|
2012-03-31 00:09:55 +02:00
|
|
|
func isPermission(err error) bool {
|
2017-01-14 01:05:42 +01:00
|
|
|
err = underlyingError(err)
|
2012-05-04 17:01:11 +02:00
|
|
|
return err == syscall.ERROR_ACCESS_DENIED || err == ErrPermission
|
2012-03-30 23:27:11 +02:00
|
|
|
}
|