New FileTreeView update on visualruby


#1

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.

https://github.com/Beagle123/visualruby

Best,
Eric