class ParFS(FS): def __init__(self, parpath): self.parpath=parpath self.__pfile=ParFile(parpath) def ministat(self, path): return self.__pfile.stat(path)[6:] def open(self, path, mode="r"): if mode<>'r': raise VFSException, "unsupported file open mode" return RO_StringIO(path, self.__pfile.read(path)) def listdir(self, dir): names=self.__pfile.names() if not dir.endswith('.'): dir+='/' if dir not in names: raise VFSException, "directory %s not found" % dir return filter(lambda x, y=dir: x.startswith(y) \ and y!=x \ and '/' not in x[len(y):-1], names) def isfile(self, path): return not self.__pfile.isdir(path) def isdir(self, path): return self.__pfile.isdir(path)
class ParFS(FS): def __init__(self, parpath): self.parpath = parpath self.__pfile = ParFile(parpath) def ministat(self, path): return self.__pfile.stat(path)[6:] def open(self, path, mode="r"): if mode <> 'r': raise VFSException, "unsupported file open mode" return RO_StringIO(path, self.__pfile.read(path)) def listdir(self, dir): names = self.__pfile.names() if not dir.endswith('.'): dir += '/' if dir not in names: raise VFSException, "directory %s not found" % dir return filter(lambda x, y=dir: x.startswith(y) \ and y!=x \ and '/' not in x[len(y):-1], names) def isfile(self, path): return not self.__pfile.isdir(path) def isdir(self, path): return self.__pfile.isdir(path)
def __init__(self, parpath): self.parpath=parpath self.__pfile=ParFile(parpath)
def __init__(self, parpath): self.parpath = parpath self.__pfile = ParFile(parpath)