Exemple #1
0
 def copy_real(self,name,cluster,data,**kwargs):
     nclusters = int(len(data)/self.bs.cluster_size()+1)
     # actually make file
     chain = self.fat.create_chain(nclusters)
     kwargs['start'] = chain[0]
     kwargs['size']  = len(data)
     kwargs.setdefault('mdate',str2date(time.strftime("%d/%m/%Y")))
     kwargs.setdefault('mtime',str2time(time.strftime("%H:%M:%S")))
     de = DirEntry(**kwargs)
     de.encode_name(name)
     self.add_direntry(cluster,de)
     for i,c in enumerate(chain):
         self.clusterdata[c] = data[i*self.bs.cluster_size():
                                    (i+1)*self.bs.cluster_size()]
Exemple #2
0
 def mkdir_real(self,name,cluster,**kwargs):
     # actually make directory
     newstart = self.fat.create_chain(1)[0]
     kwargs['attr']  = DirEntry.ATTR_DIR | kwargs.get('attr',0)
     kwargs['start'] = newstart
     kwargs.setdefault('mdate',str2date(time.strftime("%d/%m/%Y")))
     kwargs.setdefault('mtime',str2time(time.strftime("%H:%M:%S")))
     de = DirEntry(**kwargs)
     de.encode_name(name)
     self.add_direntry(cluster,de)
     de.set_name('.')
     self.clusterdata[newstart] = de.to_raw()
     de.set_name('..')
     de.start = cluster
     self.clusterdata[newstart] += de.to_raw()
Exemple #3
0
 def set_voldate(self,date=None):
     if date is None: date = str2date(time.strftime("%d/%m/%Y"))
     self.set_volattr('mdate',date)