fix: cold_word_drop for windows (#433)

This commit is contained in:
Shingo 2023-08-08 19:55:48 +08:00 committed by GitHub
parent 98ef0c1846
commit 010a1bc668
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -14,6 +14,11 @@ local tbls = {
local function get_record_filername(record_type) local function get_record_filername(record_type)
local user_distribute_name = rime_api:get_distribution_name()
if user_distribute_name == '小狼毫' then
return string.format("%%APPDATA%%\\Rime\\lua\\cold_word_record\\%s_words.lua", record_type)
end
local system = io.popen("uname -s"):read("*l") local system = io.popen("uname -s"):read("*l")
local filename = nil local filename = nil
-- body -- body
@ -21,8 +26,6 @@ local function get_record_filername(record_type)
filename = string.format("%s/Library/Rime/lua/cold_word_drop/%s_words.lua", os.getenv('HOME'), record_type) filename = string.format("%s/Library/Rime/lua/cold_word_drop/%s_words.lua", os.getenv('HOME'), record_type)
elseif system == "Linux" then elseif system == "Linux" then
filename = string.format("%s/.config/ibus/rime/lua/cold_word_drop/%s_words.lua", os.getenv('HOME'), record_type) filename = string.format("%s/.config/ibus/rime/lua/cold_word_drop/%s_words.lua", os.getenv('HOME'), record_type)
else
filename = string.format("%%APPDATA%%\\Rime\\lua\\cold_word_drop\\%s_words.lua", record_type)
end end
return filename return filename
end end
@ -143,4 +146,4 @@ local function processor(key, env)
return 2 -- kNoop, 不做任何操作, 交给下个组件处理 return 2 -- kNoop, 不做任何操作, 交给下个组件处理
end end
return processor return processor