示例#1
0
//Checks if a given path exsits on the filesystem.
//path: The path to look for.
//Returns nil on success, or error.
func (fs *Fs) Exists(path string) error {
	p := C.CString(path)
	defer C.free(unsafe.Pointer(p))
	ret := C.hdfsExists(fs.cptr, p)
	if ret == C.int(-1) {
		return fmt.Errorf("Path %s does not exists", path)
	}
	return nil
}
示例#2
0
文件: hdfs.go 项目: zyxar/hdfs
//Checks if a given path exsits on the filesystem.
//path: The path to look for.
//Returns nil on success, or error.
func (fs *Fs) Exists(path string) error {
	p := C.CString(path)
	defer C.free(unsafe.Pointer(p))
	ret, err := C.hdfsExists(fs.cptr, p)
	if err != nil && ret == C.int(-1) {
		return err
	}
	return nil
}