fbb0d4f3fe0f2ec1e08e51bd9834a70a43b99c8e
[platform/upstream/gcc48.git] / libgo / go / os / error_windows.go
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         if pe, ok := err.(*PathError); ok {
11                 err = pe.Err
12         }
13         return err == syscall.ERROR_ALREADY_EXISTS ||
14                 err == syscall.ERROR_FILE_EXISTS || err == ErrExist
15 }
16
17 func isNotExist(err error) bool {
18         if pe, ok := err.(*PathError); ok {
19                 err = pe.Err
20         }
21         return err == syscall.ERROR_FILE_NOT_FOUND ||
22                 err == syscall.ERROR_PATH_NOT_FOUND || err == ErrNotExist
23 }
24
25 func isPermission(err error) bool {
26         if pe, ok := err.(*PathError); ok {
27                 err = pe.Err
28         }
29         return err == syscall.ERROR_ACCESS_DENIED || err == ErrPermission
30 }