1 // Copyright 2012 The Go Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 package os 6 7 import "syscall" 8 9 func isExist(err error) bool { 10 err = underlyingError(err) 11 return err == syscall.ERROR_ALREADY_EXISTS || 12 err == syscall.ERROR_DIR_NOT_EMPTY || 13 err == syscall.ERROR_FILE_EXISTS || err == ErrExist 14 } 15 16 const _ERROR_BAD_NETPATH = syscall.Errno(53) 17 18 func isNotExist(err error) bool { 19 err = underlyingError(err) 20 return err == syscall.ERROR_FILE_NOT_FOUND || 21 err == _ERROR_BAD_NETPATH || 22 err == syscall.ERROR_PATH_NOT_FOUND || err == ErrNotExist 23 } 24 25 func isPermission(err error) bool { 26 err = underlyingError(err) 27 return err == syscall.ERROR_ACCESS_DENIED || err == ErrPermission 28 } 29