示例#1
0
文件: linuxdir.go 项目: d3zd3z/gosure
func Open(name string) (result *Dir, err error) {
	tmp, err := C.opendir(C.CString(name))
	if err != nil {
		return
	}

	result = (*Dir)(tmp)
	return
}
示例#2
0
文件: ffi.go 项目: plar/pachyderm
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
}
示例#3
0
文件: btrfs.go 项目: BreezeWu/docker
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
}