Example #1
0
func Open(name string) (result *Dir, err error) {
	tmp, err := C.opendir(C.CString(name))
	if err != nil {
		return
	}

	result = (*Dir)(tmp)
	return
}
Example #2
0
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
}
Example #3
0
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
}