# New FileTreeView update on visualruby

**URL:** <https://www.ruby-forum.com/t/new-filetreeview-update-on-visualruby/244704>\
**Category:** Ruby-Gnome 2\
**Created:** [May 30, 2016, 9:49pm UTC](https://www.ruby-forum.com/t/new-filetreeview-update-on-visualruby/244704 "2016-05-30T21:49:26Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rafa\_F](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/958977/32.png) [@Rafa\_F](https://www.ruby-forum.com/u/Rafa_F)\
**Post date:** [May 30, 2016, 9:49pm UTC](https://www.ruby-forum.com/t/new-filetreeview-update-on-visualruby/244704/1 "2016-05-30T21:49:26Z")

</div>

Hi:

I just updated the FileTreeView class in visualruby. For those of you  
who aren’t familiar with it, its a great class that automatically  
creates a tree of folders and files that is expandable and clickable  
etc. All you need to do is pass the folder path as an argument, and you  
have a “windows explorer” like file tree on the screen. You can pass a  
glob to designate what files to include and pass a code block that will  
further exclude files.

Thanks to my correspondence with the user cediemo, I realized that it  
was a little bit difficult to open a folder in visualruby because the  
user must choose a folder that contains a visualruby project in it. So  
my FileTreeView must show only folders with a hidden file,  
(.vr\_settings.yaml) in it. This task was easy with the new  
FileTreeView:

@ftv = VR::FileTreeView.new(path, “\*/\*\*/”)  
@ftv.test\_block = { |folder| has\_settings\_file?(folder) }

…

def has\_settings\_file?(path)  
Find.find(path) do |file|  
if File.basename(file) == VR\_ENV::SETTINGS\_FILE  
return true  
end  
end  
return false  
end

Now visualruby has a beautiful custom project selector that only shows  
valid visualruby project folders.

This is available on github.

> **[GitHub - Beagle123/visualruby: Make GUI programs with Ruby!](https://github.com/Beagle123/visualruby)**
>
> Make GUI programs with Ruby! Contribute to Beagle123/visualruby development by creating an account on GitHub.

Best,  
Eric
