Simple Ruby how to get user to browse for a directory

I’m looking for a way for a user to “browse for directory”

box will appear, the user may select a folder and then it will save that
directory into a string

Thanks

hi Christopher -

this will depend on the graphics toolkit you’re using. check out
Shoes - http://shoesrb.com/ - it’s awesomely simple, and you can really
do quite a lot with it once you get into it.

to display a directory selection dialog in Shoes, you could just do
this:

Shoes.app do
button(“open folder”){
selected_folder = ask_open_folder
p selected_folder if selected_folder
}
end

  • j

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs