func Open(name string) (result *Dir, err error) { tmp, err := C.opendir(C.CString(name)) if err != nil { return } result = (*Dir)(tmp) return }
func ffiOpenDir(path string) (*C.DIR, error) { Cpath := C.CString(path) defer C.free(unsafe.Pointer(Cpath)) dir := C.opendir(Cpath) if dir == nil { return nil, fmt.Errorf("cannot open dir: %s", path) } return dir, nil }
func openDir(path string) (*C.DIR, error) { Cpath := C.CString(path) defer free(Cpath) dir := C.opendir(Cpath) if dir == nil { return nil, fmt.Errorf("Can't open dir") } return dir, nil }