Esempio n. 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('/')
Esempio n. 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('/')
Esempio n. 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
Esempio n. 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
Esempio n. 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
Esempio n. 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
Esempio n. 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
Esempio n. 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