@@ -4802,6 +4802,7 @@ package.preload["library.utils"] = package.preload["library.utils"] or function(
4802
4802
local fcstr = finale .FCString (directory_path )
4803
4803
fcstr :AssureEndingPathDelimiter ()
4804
4804
directory_path = fcstr .LuaString
4805
+
4805
4806
local lfs_directory_path = text .convert_encoding (directory_path , text .get_utf8_codepage (), text .get_default_codepage ())
4806
4807
return coroutine.wrap (function ()
4807
4808
for lfs_file in lfs .dir (lfs_directory_path ) do
@@ -4933,6 +4934,30 @@ package.preload["library.client"] = package.preload["library.client"] or functio
4933
4934
end
4934
4935
return input_string
4935
4936
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
4936
4961
return client
4937
4962
end
4938
4963
package.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
5132
5157
end
5133
5158
5134
5159
function library .get_smufl_font_list ()
5135
- local osutils = finenv . EmbeddedLuaOSUtils and require (" luaosutils" )
5160
+ local osutils = client . supports ( " luaosutils " ) and require (" luaosutils" )
5136
5161
local font_names = {}
5137
5162
local add_to_table = function (for_user )
5138
5163
local smufl_directory = calc_smufl_directory (for_user )
@@ -5143,11 +5168,7 @@ package.preload["library.general_library"] = package.preload["library.general_li
5143
5168
end
5144
5169
5145
5170
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 " "
5151
5172
end
5152
5173
local is_font_available = function (dir )
5153
5174
local fc_dir = finale .FCString ()
0 commit comments