本文整理匯總了Golang中github.com/hanwen/go-fuse/fuse.DirEntry.Name方法的典型用法代碼示例。如果您正苦於以下問題:Golang DirEntry.Name方法的具體用法?Golang DirEntry.Name怎麽用?Golang DirEntry.Name使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/hanwen/go-fuse/fuse.DirEntry
的用法示例。
在下文中一共展示了DirEntry.Name方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: OpenDir
func (fs *MultiZipFs) OpenDir(name string, context *fuse.Context) (stream []fuse.DirEntry, code fuse.Status) {
fs.lock.RLock()
defer fs.lock.RUnlock()
stream = make([]fuse.DirEntry, 0, len(fs.zips)+2)
if name == "" {
var d fuse.DirEntry
d.Name = "config"
d.Mode = fuse.S_IFDIR | 0700
stream = append(stream, fuse.DirEntry(d))
}
if name == "config" {
for k := range fs.zips {
var d fuse.DirEntry
d.Name = k
d.Mode = fuse.S_IFLNK
stream = append(stream, fuse.DirEntry(d))
}
}
return stream, fuse.OK
}
示例2: OpenDir
func (me *MultiZipFs) OpenDir(name string) (stream chan fuse.DirEntry, code fuse.Status) {
me.lock.RLock()
defer me.lock.RUnlock()
// We don't use a goroutine, since we don't want to hold the
// lock.
stream = make(chan fuse.DirEntry,
len(me.pendingZips)+len(me.zips)+2)
submode := uint32(fuse.S_IFDIR | 0700)
if name == "config" {
submode = fuse.S_IFREG | 0600
}
for k, _ := range me.zips {
var d fuse.DirEntry
d.Name = k
d.Mode = submode
stream <- fuse.DirEntry(d)
}
for k, _ := range me.pendingZips {
var d fuse.DirEntry
d.Name = k
d.Mode = submode
stream <- fuse.DirEntry(d)
}
if name == "" {
var d fuse.DirEntry
d.Name = "config"
d.Mode = fuse.S_IFDIR | 0700
stream <- fuse.DirEntry(d)
}
close(stream)
return stream, fuse.OK
}
示例3: OpenDir
func (me *MultiZipFs) OpenDir(name string, context *fuse.Context) (stream chan fuse.DirEntry, code fuse.Status) {
me.lock.RLock()
defer me.lock.RUnlock()
stream = make(chan fuse.DirEntry, len(me.zips)+2)
if name == "" {
var d fuse.DirEntry
d.Name = "config"
d.Mode = fuse.S_IFDIR | 0700
stream <- fuse.DirEntry(d)
}
if name == "config" {
for k, _ := range me.zips {
var d fuse.DirEntry
d.Name = k
d.Mode = fuse.S_IFLNK
stream <- fuse.DirEntry(d)
}
}
close(stream)
return stream, fuse.OK
}
示例4: OpenDir
func (me *DropboxFs) OpenDir(name string, context *fuse.Context) (c []fuse.DirEntry, code fuse.Status) {
path := get_path(name)
log.Printf("OpenDir: '%s'\n", name)
data, err := Cache.Metadata.Get(path)
entry := fuse.DirEntry{}
if data.IsDir && err == nil {
for _, path := range data.Contents {
entry.Name = NameFromPath(path)
c = append(c, entry)
}
return c, fuse.OK
}
return nil, fuse.ENOENT
}