From 8572842c51475e1b7bf5061512ff670f047fdb19 Mon Sep 17 00:00:00 2001 From: Steve Slaven Date: Wed, 22 Jul 2009 16:20:21 -0700 Subject: Some better list handling to extract sub paths diff --git a/fusearchive.py b/fusearchive.py index f3b5093..032f0e9 100755 --- a/fusearchive.py +++ b/fusearchive.py @@ -40,6 +40,8 @@ def flag2mode(flags): def inflate( src, dest ): print "inflate!" +# TODO: deflate only if the file has been modified + # Deflate a file, src is the unpacked file, dest is where we want to pack # to, and we assume storage/ is where chunks are stored def deflate( src, dest ): @@ -65,15 +67,15 @@ def deflate( src, dest ): # Write out our chunk chars = list( digest ) print chars - subparts = []; - for l in range( 0, magic_depth ): - subparts.append( "%02x" % ord( chars.pop( 0 ) ) ) # We make the hexdigest here, yeah we could just call hexdigest() # but we need to essentially do this same thing to reassemble the # file anyway hexdigest = ''.join( [ "%02x" % ord( x ) for x in chars ] ); + # Subparts just needs the first N chars + subparts = [ "%02x" % ord( x ) for x in chars[ :magic_depth ] ] + print subparts subpath = '/'.join( subparts ); print "Subpath: " + subpath -- cgit v0.10.2