...
Run Format

Source file src/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		switch pe := err.(type) {
    11		case nil:
    12			return false
    13		case *PathError:
    14			err = pe.Err
    15		case *LinkError:
    16			err = pe.Err
    17		}
    18		return err == syscall.ERROR_ALREADY_EXISTS ||
    19			err == syscall.ERROR_FILE_EXISTS || err == ErrExist
    20	}
    21	
    22	func isNotExist(err error) bool {
    23		switch pe := err.(type) {
    24		case nil:
    25			return false
    26		case *PathError:
    27			err = pe.Err
    28		case *LinkError:
    29			err = pe.Err
    30		}
    31		return err == syscall.ERROR_FILE_NOT_FOUND ||
    32			err == syscall.ERROR_PATH_NOT_FOUND || err == ErrNotExist
    33	}
    34	
    35	func isPermission(err error) bool {
    36		switch pe := err.(type) {
    37		case nil:
    38			return false
    39		case *PathError:
    40			err = pe.Err
    41		case *LinkError:
    42			err = pe.Err
    43		}
    44		return err == syscall.ERROR_ACCESS_DENIED || err == ErrPermission
    45	}
    46	

View as plain text