Skip to content

Instantly share code, notes, and snippets.

@supermomonga
Last active August 29, 2015 14:20
Show Gist options
  • Save supermomonga/16d0c6ac166f63ba2234 to your computer and use it in GitHub Desktop.
Save supermomonga/16d0c6ac166f63ba2234 to your computer and use it in GitHub Desktop.
JRubyFXのfxml_rootをjarパッケージング時にも適切に動作する形で設定する ref: http://qiita.com/supermomonga/items/210ab629da519381070b
fxml_root File.dirname(__FILE__)
class KawaiiController
include JRubyFX::Controller
fxml "輿水幸子.fxml"
end
def jar_filename
$LOAD_PATH.map{|it|
it.split('/')
}.flatten.uniq.select{|it|
it.match /^(?!jruby-complete\.jar!)(?!jruby-stdlib-[0-9\.]+\.jar!).+\.jar!$/
}.first.tap{|it| break it.tr('!','') unless it.nil?}
end
fxml_root File.dirname(__FILE__), jar_filename
if JRubyFX::Application.in_jar?
fxml_root nil, '乙倉悠貴.jar'
else
fxml_root File.dirname(__FILE__)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment