@Rafael: The API UI module does not have a folderpicker, YET. We have filed Feature Requests for one, and fontpicker, and colorpicker, and etc., etc.
For now users must pick a file within the target folder. (We are out of luck if the folder is empty.)
@thomthom said:
@dan rathbun said:
@sound = filepath.gsub("\\",'/')
Since / as path separator isn't hard coded I tend to use:
@sound = File.expand_path(filepath)
One could also do:
@sound = filepath.gsub("\\", File::SEPARATOR)
But I prefer the first.
Your second one is safer. Yes I got lazy, but my purpose here is going from the OS to Ruby. I imagine that after tha statement the path will be used by Ruby's Dir and File methods.
Later on... to go back to the OS I'd use filepath.gsub("\/", File::SEPARATOR) if it is even necessary.
Be careful with expand_path() because it is DUMB!
Your example will work only because the UI.openpanel method returns an absolute path.
When the path is a relative path,... the method simply concatenates the current working directory path and the argument path, regardless if the result is really a valid path.