示例#1
0
 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('/')
示例#2
0
 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('/')
示例#3
0
 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
示例#4
0
 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
示例#5
0
 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
示例#6
0
 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
示例#7
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
示例#8
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