示例#1
0
 def getattr(self, path, fh=None):
     if path == '/' or path == "/." or path == "/..":
         return dict(
             st_mode=stat.S_IFDIR | 0555,
             st_nlink=2,
         )
     elif is_dir(path):
         return dict(
             st_mode=stat.S_IFDIR | 0555,
             st_nlink=3,
         )
     elif is_file(path):
         def _get_file_mode():
             if is_executable(path):
                 return 0555
             elif path == PATH_MODULES:
                 return 0666
             else:
                 return 0444
         return dict(
             st_mode=stat.S_IFREG | _get_file_mode(),
             st_nlink=1,
             st_size=len(get_content(path)),
         )
     else:
         raise fuse.FuseOSError(errno.ENOENT)
示例#2
0
 def get_text(self):
     return get_content(self.path)
示例#3
0
 def read(self, path, size, offset, fh):
     return read_from_string(
         get_content(path),
         size,
         offset,
     )