def isfile(self, path): adjusted=adjust_user_path(path) if not self._archive.paths.has_key(adjusted): return 0 realname=self._archive.paths[adjusted] if realname==None: return 0 else: return not adjusted.endswith('/')
def isfile(self, path): adjusted = adjust_user_path(path) if not self._archive.paths.has_key(adjusted): return 0 realname = self._archive.paths[adjusted] if realname == None: return 0 else: return not adjusted.endswith('/')
def vstat(self, path): adjusted=adjust_user_path(path) if not self._archive.paths.has_key(adjusted): raise FileNotFoundException, path realname=self._archive.paths[adjusted] if realname==None: arcstat=os.stat(self.zpath)[7:] return (0,) + arcstat info=self._zfile.getinfo(realname) modtime=int(time.mktime(info.date_time + (0, 0, 0))) return info.file_size, -1, modtime, modtime
def open(self, path, mode='r'): adjusted = adjust_user_path(path) if mode != 'r': raise NotWriteableException, "unsupported file open mode: %s" % mode if not self._archive.paths.has_key(adjusted): raise FileNotFoundException, path realname = self._archive.paths[adjusted] if realname != None: return ReadOnlyStream(adjusted, self._zfile.read(realname)) else: raise VFSException, "cannot open directory as file: %s" % path
def vstat(self, path): adjusted = adjust_user_path(path) if not self._archive.paths.has_key(adjusted): raise FileNotFoundException, path realname = self._archive.paths[adjusted] if realname == None: arcstat = os.stat(self.zpath)[7:] return (0, ) + arcstat info = self._zfile.getinfo(realname) modtime = int(time.mktime(info.date_time + (0, 0, 0))) return info.file_size, -1, modtime, modtime
def open(self, path, mode='r'): adjusted=adjust_user_path(path) if mode!='r': raise NotWriteableException, "unsupported file open mode: %s" % mode if not self._archive.paths.has_key(adjusted): raise FileNotFoundException, path realname=self._archive.paths[adjusted] if realname!=None: return ReadOnlyStream(adjusted, self._zfile.read(realname)) else: raise VFSException, "cannot open directory as file: %s" % path
def isdir(self, path): adjusted=adjust_user_path(path) if not self._archive.paths.has_key(adjusted): return 0 realname=self._archive.paths[adjusted] if realname==None: return 1 else: # on UNIX, I'd hope to get this from file attributes; # Per Boethner's implementation of java.util.zip.ZipEntry # for GNU Classpath only tests the final slash return realname.endswith('/') and \ self._zfile.getinfo(realname).file_size==0
def isdir(self, path): adjusted = adjust_user_path(path) if not self._archive.paths.has_key(adjusted): return 0 realname = self._archive.paths[adjusted] if realname == None: return 1 else: # on UNIX, I'd hope to get this from file attributes; # Per Boethner's implementation of java.util.zip.ZipEntry # for GNU Classpath only tests the final slash return realname.endswith('/') and \ self._zfile.getinfo(realname).file_size==0