Alle mercoled19 settembre 2007, Une Bue ha scritto:
> forbiddenList:
> - /Volumes/EMTEC KEY/emtec_dl
> - /Volumes/EMTEC KEY/emtec_dl/v233r001/Setup.exe
> - /Volumes/U3 System
> - /Volumes/U3 System/Launchpad.zip
>
> your select_toplevel_paths don't remove /Volumes/EMTEC
> KEY/emtec_dl/v233r001/Setup.exe and /Volumes/U3 System/Launchpad.zip

It works for me:

irb: 001> def select_toplevel_path arg
irb: 002+>  a = arg.dup.sort_by{|i| i.size}
irb: 003+>   a.inject([]) do |res, i|
irb: 004*>     res.any?{|j| i[0, j.size] == j} ? res : (res << i)
irb: 005+>   end
irb: 006+> end
nil
irb: 007> forbidden = ["/Volumes/EMTEC KEY/emtec_dl",
irb: 008*>  "/Volumes/EMTEC KEY/emtec_dl/v233r001/Setup.exe",
irb: 009*>  "/Volumes/U3 System",
irb: 010*>  "/Volumes/U3 System/Launchpad.zip"
irb: 011+>             ]
["/Volumes/EMTEC KEY/emtec_dl", "/Volumes/EMTEC 
KEY/emtec_dl/v233r001/Setup.exe", "/Volumes/U3 System", "/Volumes/U3 
System/Launchpad.zip"]
irb: 012> select_toplevel_path forbidden
["/Volumes/U3 System", "/Volumes/EMTEC KEY/emtec_dl"]

Notice that this doesn't change the forbidden array, but creates a new one.

Stefano