-- <user_data_dir>/lua/plugin/?.(so|dylib|dll) 加入 package.cpath
local function init_cpath()
local path= ("./lua/plugin/"):gsub("/",package.config:sub(1,1) )
local pattern = path:gsub("([.?/%\\])","%%%1")
-- pattern --> "%.%/lua%/plugin%/" or "%.%\\lua%\\plugin%\\"
if not package.cpath:match( pattern ) then
local cp=package.cpath
local df= cp:match('?.so') or cp:match('?.dylib') or cp:match('?.dll')
package.cpath= package.cpath .. (df and ";" .. path .. df or "")
end
end
Signed-off-by: Shewer Lu shewer@gmail.com 從 shell調用wordninja 非常浪費 因爲 每次都要載入 wordninja_words.txt 且 重算權重
建議