Last active
August 29, 2015 14:20
-
-
Save supermomonga/16d0c6ac166f63ba2234 to your computer and use it in GitHub Desktop.
JRubyFXのfxml_rootをjarパッケージング時にも適切に動作する形で設定する ref: http://qiita.com/supermomonga/items/210ab629da519381070b
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fxml_root File.dirname(__FILE__) | |
class KawaiiController | |
include JRubyFX::Controller | |
fxml "輿水幸子.fxml" | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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