@@ -4802,6 +4802,7 @@ package.preload["library.utils"] = package.preload["library.utils"] or function(
48024802 local fcstr = finale .FCString (directory_path )
48034803 fcstr :AssureEndingPathDelimiter ()
48044804 directory_path = fcstr .LuaString
4805+
48054806 local lfs_directory_path = text .convert_encoding (directory_path , text .get_utf8_codepage (), text .get_default_codepage ())
48064807 return coroutine.wrap (function ()
48074808 for lfs_file in lfs .dir (lfs_directory_path ) do
@@ -4933,6 +4934,30 @@ package.preload["library.client"] = package.preload["library.client"] or functio
49334934 end
49344935 return input_string
49354936 end
4937+
4938+ function client .encode_with_utf8_codepage (input_string )
4939+ if client .supports (" luaosutils" ) then
4940+ local text = require (" luaosutils" ).text
4941+ if text and text .get_default_codepage () ~= text .get_utf8_codepage () then
4942+ return text .convert_encoding (input_string , text .get_default_codepage (), text .get_utf8_codepage ())
4943+ end
4944+ end
4945+ return input_string
4946+ end
4947+
4948+ function client .execute (command )
4949+ if client .supports (" luaosutils" ) then
4950+ local process = require (" luaosutils" ).process
4951+ if process then
4952+ return process .execute (command )
4953+ end
4954+ end
4955+ local handle = io.popen (command )
4956+ if not handle then return nil end
4957+ local retval = handle :read (" *a" )
4958+ handle :close ()
4959+ return retval
4960+ end
49364961 return client
49374962end
49384963package.preload [" library.general_library" ] = package.preload [" library.general_library" ] or function ()
@@ -5132,7 +5157,7 @@ package.preload["library.general_library"] = package.preload["library.general_li
51325157 end
51335158
51345159 function library .get_smufl_font_list ()
5135- local osutils = finenv . EmbeddedLuaOSUtils and require (" luaosutils" )
5160+ local osutils = client . supports ( " luaosutils " ) and require (" luaosutils" )
51365161 local font_names = {}
51375162 local add_to_table = function (for_user )
51385163 local smufl_directory = calc_smufl_directory (for_user )
@@ -5143,11 +5168,7 @@ package.preload["library.general_library"] = package.preload["library.general_li
51435168 end
51445169
51455170 local cmd = finenv .UI ():IsOnWindows () and " dir " or " ls "
5146- local handle = io.popen (cmd .. options .. " \" " .. smufl_directory .. " \" " )
5147- if not handle then return " " end
5148- local retval = handle :read (" *a" )
5149- handle :close ()
5150- return retval
5171+ return client .execute (cmd .. options .. " \" " .. smufl_directory .. " \" " ) or " "
51515172 end
51525173 local is_font_available = function (dir )
51535174 local fc_dir = finale .FCString ()
0 commit comments