コード例 #1
0
 def isfile(self, path):
     adjusted=pathutil._adjust_user_path(path)
     if not self.__archive.paths.has_key(adjusted):
         #raise FileNotFoundException, path
         return 0
     realname=self.__archive.paths[adjusted]
     if realname==None:
         return 0
     else:
         return not adjusted.endswith('/')
コード例 #2
0
    def isfile(self, path):
        bslog('isfile %s' % path)
        adjusted=pathutil._adjust_user_path(path)
        if not self.__archive.paths.has_key(adjusted):
            #raise VFSException, "no such file or directory: %s" % path
	    return 0
        realname=self.__archive.paths[adjusted]
        if realname==None:
            return 0
        else:
            return not adjusted.endswith('/')
コード例 #3
0
 def ministat(self, path):
     bslog('ministat %s' % path)
     adjusted=pathutil._adjust_user_path(path)
     if not self.__archive.paths.has_key(adjusted): 
         raise VFSException, "no such file or directory: %s" % path
     realname=self.__archive.paths[adjusted]
     if realname==None:
         arcstat=os.stat(self.zpath)[7:]
         return (0,) + arcstat
     item = self._contents[realname]
     return item[1], -1, item[2], item[2]
コード例 #4
0
 def ministat(self, path):
     adjusted=pathutil._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
コード例 #5
0
    def isdir(self, path):
        bslog('isdir %s' % path)
        adjusted=pathutil._adjust_user_path(path)
        if not self.__archive.paths.has_key(adjusted):
            #raise VFSException, "no such file or directory: %s" % path
	    return 0
        realname=self.__archive.paths[adjusted]
        if realname==None:
            return 1
        else:
            return realname.endswith('/') and \
                   self._contents[realname][1]==0
コード例 #6
0
 def open(self, path, mode='r'):
     adjusted=pathutil._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 RO_StringIO(adjusted,
                            self.__zfile.read(realname))
     else:
         raise VFSException, "cannot open directory as file: %s" % path
コード例 #7
0
 def isdir(self, path):
     bslog('isdir %s' % path)
     adjusted = pathutil._adjust_user_path(path)
     if not self.__archive.paths.has_key(adjusted):
         #raise VFSException, "no such file or directory: %s" % path
         return 0
     realname = self.__archive.paths[adjusted]
     if realname == None:
         return 1
     else:
         return realname.endswith('/') and \
                self._contents[realname][1]==0
コード例 #8
0
 def open(self, path, mode='r'):
     bslog('getting %s' % path)
     adjusted = pathutil._adjust_user_path(path)
     if mode != 'r':
         raise VFSException, "unsupported file open mode"
     if not self.__archive.paths.has_key(adjusted):
         raise VFSException, "no such file or directory: %s" % path
     realname = self.__archive.paths[adjusted]
     if realname != None:
         return RO_StringIO(adjusted, self._contents[realname][0])
     else:
         raise VFSException, "cannot open directory as file: %s" % path
コード例 #9
0
 def open(self, path, mode='r'):
     bslog('getting %s' % path)
     adjusted=pathutil._adjust_user_path(path)
     if mode!='r':
         raise VFSException, "unsupported file open mode"
     if not self.__archive.paths.has_key(adjusted):
         raise VFSException, "no such file or directory: %s" % path
     realname=self.__archive.paths[adjusted]
     if realname!=None:
         return RO_StringIO(adjusted,
                            self._contents[realname][0])
     else:
         raise VFSException, "cannot open directory as file: %s" % path
コード例 #10
0
 def isdir(self, path):
     adjusted=pathutil._adjust_user_path(path)
     if not self.__archive.paths.has_key(adjusted):
         #raise FileNotFoundException, path
         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
コード例 #11
0
 def isdir(self, path):
     adjusted = pathutil._adjust_user_path(path)
     if not self.__archive.paths.has_key(adjusted):
         #raise FileNotFoundException, path
         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