1
## 20_deduped_directory_hashing.dpatch by Taku YASUI <tach@debian.org>
4
diff -urNad trunk~/lib-plugins/yapra/plugin/filter/deduped.rb trunk/lib-plugins/yapra/plugin/filter/deduped.rb
5
--- trunk~/lib-plugins/yapra/plugin/filter/deduped.rb 2009-06-23 21:39:50.000000000 +0900
6
+++ trunk/lib-plugins/yapra/plugin/filter/deduped.rb 2009-09-04 21:37:37.719146332 +0900
8
if attribute && d.respond_to?(attribute)
9
v = d.__send__(attribute).to_s
11
- hashpath = File.join(cachepath.to_s, Digest::MD5.hexdigest(v))
12
+ digest = Digest::MD5.hexdigest(v)
13
+ hashpath = File.join(cachepath.to_s, digest[0,2], digest[2,2], digest)
14
if File.exists?(hashpath)
18
File.open(hashpath, "wb").write(v)
19
@cache_paths << hashpath
21
+ rescue Errno::ENOENT
22
+ FileUtils.mkdir_p(File.dirname(hashpath))
28
FileUtils.rm(@cache_paths, {:force => true})
32
\ No newline at end of file