Subject: | bugfix and improvement for dirselect |
At line 209 of FileSystem.pm, it says
($d) =~ /^(\w+:)/;
I think the point is to delete the slash or backslash off of the drive
letter, but the above statement does not accomplish that. Instead, I think
$d = $1 if ($d =~ /^(\w+:)/);
is better. I noticed this when I was trying to improve the dirtree
mechanism... Instead of calling
$dirs->configure(-directory => $d)
when adding directories to the tree, we should call
$dirs->add_to_tree($d, $d)
The reason is, when you call configure, it tries to navigate to that
directory at the moment of insertion, and it tries to read all the
contents of that directory at the moment of insertion. This can be an
extremely time-consuming process in case the directory is shared over
the network -- and the wizard window freezes until the dirtree is
completely built. If we call add_to_tree, it does not do any
pre-loading of the folder contents, and the wizard window finishes
drawing very quickly.
In addition, the DirTree widget does not allow you to add an item that
already exists in the tree. This happens with the wizard because before
adding all the $_drives, the current folder has already been added.
This can be worked around by wrapping the calls to add_to_tree in an eval.
To summarize, I recommend changing lines 214, 218, and 223 of
FileSystem.pm so that they call
eval { $dirs->add_to_tree($d, $d) }