Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def dialog(options)
- type = options[:type]
- string = ""
- options.each_pair do |key, value|
- str << " --#{e_sh key} "
- Array(value).map { |s| e_sh s }.join(" ")
- end
- cd = ENV['TM_SUPPORT_PATH'] + '/bin/CocoaDialog.app/Contents/MacOS/CocoaDialog'
- result = %x{#{e_sh cd} 2>/dev/console #{e_sh type} #{str}}
- return_value = result.slice!(/^([^\n]+)\n/).chomp
- if return_value == "Cancel" then
- if block_given? then
- throw SystemExit
- else
- return nil
- end
- else
- yield result if block_given?
- return result
- end
- end
Add Comment
Please, Sign In to add comment