summaryrefslogtreecommitdiff
path: root/ext/tk/tcltklib.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-10-31 23:39:37 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-10-31 23:39:37 +0000
commit1a2a4084d94b750646874e5f383b34fcc606dcc9 (patch)
tree431436df341f2b2c3278d668ffc3f3c0b5b28601 /ext/tk/tcltklib.c
parent753ee6ac571f54497e56255033a9b1f005213243 (diff)
tcltklib.c: basename
* ext/tk/tcltklib.c (setup_rubytkkit): use ruby_enc_find_basename if available, instead of File.basename. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52417 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/tk/tcltklib.c')
-rw-r--r--ext/tk/tcltklib.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/ext/tk/tcltklib.c b/ext/tk/tcltklib.c
index 01479301d8..2906cb7281 100644
--- a/ext/tk/tcltklib.c
+++ b/ext/tk/tcltklib.c
@@ -1263,11 +1263,17 @@ setup_rubytkkit(void)
#ifdef __WIN32__
/* rbtk_win32_SetHINSTANCE("tcltklib.so"); */
{
+# ifdef HAVE_RUBY_ENC_FIND_BASENAME
+ const char *base = ruby_enc_find_basename(rb_sourcefile(), NULL, NULL,
+ rb_filesystem_encoding());
+ rbtk_win32_SetHINSTANCE(base);
+# else
VALUE basename;
basename = rb_funcall(rb_cFile, rb_intern("basename"), 1,
rb_str_new2(rb_sourcefile()));
rbtk_win32_SetHINSTANCE(RSTRING_PTR(basename));
RB_GC_GUARD(basename);
+# endif
}
#endif
set_rubytk_kitpath(rb_sourcefile());