可以帮忙解决一下加载schema的问题吗
Coloryr opened this issue · comments
Describe the bug
这是我的代码
RimeTraits traits = new()
{
shared_data_dir = AppContext.BaseDirectory,
user_data_dir = AppContext.BaseDirectory,
distribution_name = "123",
distribution_code_name = "456",
distribution_version = "789",
app_name = "RimeSharp",
min_log_level = 0,
log_dir = AppContext.BaseDirectory
};
Rime.RimeSetup(traits);
Rime.RimeSetNotificationHandler(Handel, 0);
Rime.RimeInitialize(traits);
Rime.RimeDeployerInitialize(traits);
var res = Rime.RimeDeploySchema("E:\\code\\RimeSharp\\RimeSharp.Test\\bin\\Debug\\net8.0\\rime-pinyin-simp-master\\pinyin_simp.schema.yaml");
Rime.RimeStartMaintenance(false);
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection.Metadata;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
namespace RimeSharp;
public delegate void RimeNotificationHandler(IntPtr context_object, IntPtr session_id, string message_type, string message_value);
public static partial class Rime
{
public const string LibName = "rime";
/// <summary>
/// Call this function before accessing any other API.
/// </summary>
/// <param name="traits"></param>
[DllImport(LibName)]
public static extern void RimeSetup(in RimeTraits traits);
/// <summary>
/// Pass a C-string constant in the format "rime.x"
/// where 'x' is the name of your application.
/// Add prefix "rime." to ensure old log files are automatically cleaned.
/// </summary>
/// <param name="app_name"></param>
[DllImport(LibName)]
[Obsolete("Use RimeSetup() instead")]
public static extern void RimeSetupLogging(string app_name);
/// <summary>
/// - on loading schema:
/// + message_type="schema", message_value="luna_pinyin/Luna Pinyin"
/// - on changing mode:
/// + message_type="option", message_value="ascii_mode"
/// + message_type="option", message_value="!ascii_mode"
/// - on deployment:
/// + session_id = 0, message_type="deploy", message_value="start"
/// + session_id = 0, message_type="deploy", message_value="success"
/// + session_id = 0, message_type="deploy", message_value="failure"
///
/// handler will be called with context_object as the first parameter
/// every time an event occurs in librime, until RimeFinalize() is called.
/// when handler is NULL, notification is disabled.
/// </summary>
/// <param name="handler"></param>
/// <param name="context_object"></param>
[DllImport(LibName)]
public static extern void RimeSetNotificationHandler(RimeNotificationHandler handler, IntPtr context_object);
[DllImport(LibName)]
public static extern void RimeInitialize(in RimeTraits traits);
[DllImport(LibName)]
public static extern void RimeFinalize();
[DllImport(LibName)]
public static extern bool RimeStartMaintenance(bool full_check);
[Obsolete("Use RimeStartMaintenance(full_check = False) instead.")]
[DllImport(LibName)]
public static extern bool RimeStartMaintenanceOnWorkspaceChange();
[DllImport(LibName)]
public static extern bool RimeIsMaintenancing();
[DllImport(LibName)]
public static extern void RimeJoinMaintenanceThread();
[DllImport(LibName)]
public static extern void RimeDeployerInitialize(in RimeTraits traits);
[DllImport(LibName)]
public static extern bool RimePrebuildAllSchemas();
[DllImport(LibName)]
public static extern bool RimeDeployWorkspace();
[DllImport(LibName)]
public static extern bool RimeDeploySchema(string schema_file);
[DllImport(LibName)]
public static extern bool RimeDeployConfigFile(string file_name,
string version_key);
[DllImport(LibName)]
public static extern bool RimeSyncUserData();
[DllImport(LibName)]
public static extern IntPtr RimeCreateSession();
[DllImport(LibName)]
public static extern bool RimeFindSession(IntPtr session_id);
[DllImport(LibName)]
public static extern bool RimeDestroySession(IntPtr session_id);
[DllImport(LibName)]
public static extern void RimeCleanupStaleSessions();
[DllImport(LibName)]
public static extern void RimeCleanupAllSessions();
[DllImport(LibName)]
public static extern bool RimeProcessKey(IntPtr session_id, int keycode, int mask);
/// <summary>
/// return True if there is unread commit text
/// </summary>
/// <param name="session_id"></param>
/// <returns></returns>
[DllImport(LibName)]
public static extern bool RimeCommitComposition(IntPtr session_id);
[DllImport(LibName)]
public static extern void RimeClearComposition(IntPtr session_id);
}
To Reproduce
- Run
Expected behavior
这是日志输出,它一直找不到文件
WARNING: Logging before InitGoogleLogging() is written to STDERR
I20240315 14:05:21.171592 35064 core_module.cc:20] registering core components.
I20240315 14:05:21.172588 35064 registry.cc:14] registering component: config_builder
I20240315 14:05:21.172588 35064 registry.cc:14] registering component: config
I20240315 14:05:21.172588 35064 registry.cc:14] registering component: schema
I20240315 14:05:21.172588 35064 registry.cc:14] registering component: user_config
I20240315 14:05:21.172588 35064 dict_module.cc:25] registering components from module 'dict'.
I20240315 14:05:21.172588 35064 registry.cc:14] registering component: tabledb
I20240315 14:05:21.172588 35064 registry.cc:14] registering component: stabledb
I20240315 14:05:21.172588 35064 registry.cc:14] registering component: plain_userdb
I20240315 14:05:21.172588 35064 registry.cc:14] registering component: userdb
I20240315 14:05:21.172588 35064 registry.cc:14] registering component: corrector
I20240315 14:05:21.172588 35064 registry.cc:14] registering component: dictionary
I20240315 14:05:21.172588 35064 registry.cc:14] registering component: reverse_lookup_dictionary
I20240315 14:05:21.172588 35064 registry.cc:14] registering component: user_dictionary
I20240315 14:05:21.172588 35064 registry.cc:14] registering component: userdb_recovery_task
I20240315 14:05:21.172588 35064 gears_module.cc:42] registering components from module 'gears'.
I20240315 14:05:21.172588 35064 registry.cc:14] registering component: ascii_composer
I20240315 14:05:21.172588 35064 registry.cc:14] registering component: chord_composer
I20240315 14:05:21.172588 35064 registry.cc:14] registering component: express_editor
I20240315 14:05:21.172588 35064 registry.cc:14] registering component: fluid_editor
I20240315 14:05:21.172588 35064 registry.cc:14] registering component: fluency_editor
I20240315 14:05:21.172588 35064 registry.cc:14] registering component: key_binder
I20240315 14:05:21.172588 35064 registry.cc:14] registering component: navigator
I20240315 14:05:21.172588 35064 registry.cc:14] registering component: punctuator
I20240315 14:05:21.172588 35064 registry.cc:14] registering component: recognizer
I20240315 14:05:21.172588 35064 registry.cc:14] registering component: selector
I20240315 14:05:21.172588 35064 registry.cc:14] registering component: speller
I20240315 14:05:21.172588 35064 registry.cc:14] registering component: shape_processor
I20240315 14:05:21.172588 35064 registry.cc:14] registering component: abc_segmentor
I20240315 14:05:21.172588 35064 registry.cc:14] registering component: affix_segmentor
I20240315 14:05:21.172588 35064 registry.cc:14] registering component: ascii_segmentor
I20240315 14:05:21.172588 35064 registry.cc:14] registering component: matcher
I20240315 14:05:21.172588 35064 registry.cc:14] registering component: punct_segmentor
I20240315 14:05:21.172588 35064 registry.cc:14] registering component: fallback_segmentor
I20240315 14:05:21.172588 35064 registry.cc:14] registering component: echo_translator
I20240315 14:05:21.172588 35064 registry.cc:14] registering component: punct_translator
I20240315 14:05:21.172588 35064 registry.cc:14] registering component: table_translator
I20240315 14:05:21.172588 35064 registry.cc:14] registering component: script_translator
I20240315 14:05:21.173585 35064 registry.cc:14] registering component: r10n_translator
I20240315 14:05:21.173585 35064 registry.cc:14] registering component: reverse_lookup_translator
I20240315 14:05:21.173585 35064 registry.cc:14] registering component: schema_list_translator
I20240315 14:05:21.173585 35064 registry.cc:14] registering component: switch_translator
I20240315 14:05:21.173585 35064 registry.cc:14] registering component: history_translator
I20240315 14:05:21.173585 35064 registry.cc:14] registering component: simplifier
I20240315 14:05:21.173585 35064 registry.cc:14] registering component: uniquifier
I20240315 14:05:21.173585 35064 registry.cc:14] registering component: charset_filter
I20240315 14:05:21.173585 35064 registry.cc:14] registering component: cjk_minifier
I20240315 14:05:21.173585 35064 registry.cc:14] registering component: reverse_lookup_filter
I20240315 14:05:21.173585 35064 registry.cc:14] registering component: single_char_filter
I20240315 14:05:21.173585 35064 registry.cc:14] registering component: shape_formatter
I20240315 14:05:21.173585 35064 modules.cc:94] registering components from module 'lua'.
I20240315 14:05:21.174582 35064 modules.cc:85] rime.lua info: rime.lua should be either in the rime user data directory or in the rime shared data directory
I20240315 14:05:21.174582 35064 registry.cc:14] registering component: lua_translator
I20240315 14:05:21.174582 35064 registry.cc:14] registering component: lua_filter
I20240315 14:05:21.174582 35064 registry.cc:14] registering component: lua_segmentor
I20240315 14:05:21.174582 35064 registry.cc:14] registering component: lua_processor
I20240315 14:05:21.174582 35064 grammar_module.cc:15] registering components from module 'grammar'.
I20240315 14:05:21.174582 35064 registry.cc:14] registering component: grammar
I20240315 14:05:21.174582 35064 registry.cc:14] registering component: predictor
I20240315 14:05:21.174582 35064 registry.cc:14] registering component: predict_translator
I20240315 14:05:21.174582 35064 levers_module.cc:22] registering components from module 'levers'.
I20240315 14:05:21.174582 35064 registry.cc:14] registering component: detect_modifications
I20240315 14:05:21.174582 35064 registry.cc:14] registering component: installation_update
I20240315 14:05:21.174582 35064 registry.cc:14] registering component: workspace_update
I20240315 14:05:21.174582 35064 registry.cc:14] registering component: schema_update
I20240315 14:05:21.174582 35064 registry.cc:14] registering component: config_file_update
I20240315 14:05:21.174582 35064 registry.cc:14] registering component: prebuild_all_schemas
I20240315 14:05:21.174582 35064 registry.cc:14] registering component: user_dict_upgrade
I20240315 14:05:21.174582 35064 registry.cc:14] registering component: cleanup_trash
I20240315 14:05:21.174582 35064 registry.cc:14] registering component: user_dict_sync
I20240315 14:05:21.174582 35064 registry.cc:14] registering component: backup_config_files
I20240315 14:05:21.174582 35064 registry.cc:14] registering component: clean_old_log_files
E20240315 14:05:21.175578 35064 deployment_tasks.cc:259] SchemaUpdate: invalid arguments.
E20240315 14:05:21.175578 35064 deployment_tasks.cc:328] Error updating schema: nonexistent file '""'.
I20240315 14:05:21.177572 35064 deployment_tasks.cc:85] updating rime installation info.
I20240315 14:05:21.177572 35064 config_data.cc:68] loading config file '".\\installation.yaml"'.
I20240315 14:05:21.177572 35064 deployment_tasks.cc:103] installation info exists. installation id: ec703055-85a0-417b-94a2-66e73948a602
I20240315 14:05:21.177572 35064 deployment_tasks.cc:114] sync dir: ".\\sync"
I20240315 14:05:21.177572 35064 deployment_tasks.cc:122] previous Rime version: 1.10.0
W20240315 14:05:21.178568 35064 config_data.cc:65] nonexistent config file '"E:\\code\\RimeSharp\\RimeSharp.Test\\bin\\Debug\\net8.0\\user.yaml"'.
I20240315 14:05:21.178568 35064 deployment_tasks.cc:78] modifications detected. workspace needs update.
I20240315 14:05:21.178568 35064 rime_api.cc:106] changes detected; starting maintenance.
I20240315 14:05:21.178568 35064 deployer.cc:118] starting work thread for 3 tasks.
I20240315 14:05:21.178568 42152 deployer.cc:79] running deployment tasks:
Log
If applicable, add crash log to quick focus your problem.
Screenshots
If applicable, add screenshots to help explain your problem.
Flavor(please complete the following information):
Select your flavor:
- ibus-rime
- fcitx-rime
- fcitx5-rime
- Squirrel
- Trime
- Weasel
Package:
- OS: Windows
- Version: 11
- URI: none
无论是传入字符串还是字符串指针都没有用
librime/src/rime/lever/deployment_tasks.cc
Lines 255 to 257 in 6d5bbc1
这里转换出错导致source_path_没有值
librime/src/rime/lever/deployment_tasks.cc
Line 327 in 6d5bbc1
这里报source_path_没有值,传入的参数是不是有问题,在小狼毫没有找到这个接口的应用
我直接传入的字符串指针也不行
似乎不是这么用的,参数类型不对,RimeDeploySchema的构建函数才接受字符串路径?别的地方调只能传TaskInitializer 类型的?不是很懂c++,只有new SchemaUpdate这种才能调到构造函数吧
如:
librime/src/rime/lever/deployment_tasks.cc
Line 215 in 6d5bbc1
librime/src/rime/lever/deployment_tasks.cc
Line 462 in 6d5bbc1
似乎你正在自己做一个rime前端,应该不用这样单独传方案文件,可以参考小狼毫的rime和前端对接代码,librime有一个固定的启动流程,只需要传入用户目录和共享目录即可,而不是喂方案文件
有哪里可以参考的吗
我在action找到了
I20240315 18:04:19.479589 11312 config_data.cc:72] loading config file '"E:\\code\\RimeSharp\\RimeSharp.Test\\bin\\Debug\\net8.0\\rime-pinyin-simp-master\\pinyin_simp.schema.yaml"'.
W20240315 18:04:19.480011 11312 config_data.cc:69] nonexistent config file '"E:\\code\\RimeSharp\\RimeSharp.Test\\bin\\Debug\\net8.0\\build\\pinyin_simp.schema.yaml"'.
I20240315 18:04:19.480066 11312 deployment_tasks.cc:394] missing build info
W20240315 18:04:19.480119 11312 config_data.cc:69] nonexistent config file '"E:\\code\\RimeSharp\\RimeSharp.Test\\bin\\Debug\\net8.0\\pinyin_simp.schema.yaml"'.
I20240315 18:04:19.480143 11312 auto_patch_config_plugin.cc:29] auto-patch pinyin_simp.schema:/__patch: pinyin_simp.custom:/patch?
W20240315 18:04:19.480177 11312 config_data.cc:69] nonexistent config file '"E:\\code\\RimeSharp\\RimeSharp.Test\\bin\\Debug\\net8.0\\build\\pinyin_simp.schema.yaml"'.
E20240315 18:04:19.481638 11312 deployment_tasks.cc:669] remove: 拒绝访问。: "C:\Windows\DirectX.log"
E20240315 18:04:19.481817 11312 deployment_tasks.cc:669] remove: 拒绝访问。: "C:\Windows\DtcInstall.log"
E20240315 18:04:19.481930 11312 deployment_tasks.cc:669] remove: 拒绝访问。: "C:\Windows\LAN.log"
E20240315 18:04:19.482033 11312 deployment_tasks.cc:669] remove: 拒绝访问。: "C:\Windows\lsasetup.log"
E20240315 18:04:19.482136 11312 deployment_tasks.cc:669] remove: 拒绝访问。: "C:\Windows\PFRO.log"
E20240315 18:04:19.482241 11312 deployment_tasks.cc:669] remove: 拒绝访问。: "C:\Windows\setupact.log"
E20240315 18:04:19.482362 11312 deployment_tasks.cc:669] remove: 拒绝访问。: "C:\Windows\setuperr.log"
E20240315 18:04:19.482519 11312 deployment_tasks.cc:669] remove: 拒绝访问。: "C:\Windows\WindowsUpdate.log"
I20240315 18:04:19.482600 11312 deployment_tasks.cc:85] updating rime installation info.
I20240315 18:04:19.482637 11312 config_data.cc:72] loading config file '".\\installation.yaml"'.
I20240315 18:04:19.482732 11312 deployment_tasks.cc:103] installation info exists. installation id: ec703055-85a0-417b-94a2-66e73948a602
I20240315 18:04:19.482761 11312 deployment_tasks.cc:114] sync dir: ".\\sync"
I20240315 18:04:19.482784 11312 deployment_tasks.cc:122] previous Rime version: 1.10.0
W20240315 18:04:19.483504 11312 config_data.cc:69] nonexistent config file '"E:\\code\\RimeSharp\\RimeSharp.Test\\bin\\Debug\\net8.0\\user.yaml"'.
I20240315 18:04:19.483538 11312 deployment_tasks.cc:78] modifications detected. workspace needs update.
I20240315 18:04:19.483554 11312 rime_api.cc:106] changes detected; starting maintenance.
I20240315 18:04:19.483571 11312 deployer.cc:118] starting work thread for 3 tasks.
I20240315 18:04:19.483602 1916 deployer.cc:79] running deployment tasks:
I20240315 18:04:19.486195 1916 deployment_tasks.cc:165] updating workspace.
W20240315 18:04:19.486255 1916 config_data.cc:69] nonexistent config file '"E:\\code\\RimeSharp\\RimeSharp.Test\\bin\\Debug\\net8.0\\build\\default.yaml"'.
I20240315 18:04:19.486283 1916 deployment_tasks.cc:394] missing build info
W20240315 18:04:19.486342 1916 config_data.cc:69] nonexistent config file '"E:\\code\\RimeSharp\\RimeSharp.Test\\bin\\Debug\\net8.0\\default.yaml"'.
I20240315 18:04:19.486363 1916 auto_patch_config_plugin.cc:29] auto-patch default:/__patch: default.custom:/patch?
W20240315 18:04:19.486432 1916 config_data.cc:69] nonexistent config file '"E:\\code\\RimeSharp\\RimeSharp.Test\\bin\\Debug\\net8.0\\build\\default.yaml"'.
W20240315 18:04:19.486467 1916 deployment_tasks.cc:184] schema list not defined.
I20240315 18:04:19.486488 1916 deployment_tasks.cc:583] clean up trash.
I20240315 18:04:19.486560 1916 deployer.cc:96] 3 tasks ran: 2 success, 1 failure.
可以了
解決了就關閉工單吧。
不对,还是没法加载
I20240318 09:20:02.940923 40524 deployment_tasks.cc:85] updating rime installation info.
I20240318 09:20:02.940933 40524 config_data.cc:72] loading config file '"E:\\code\\RimeSharp\\RimeSharp.Test\\bin\\Debug\\net8.0\\installation.yaml"'.
I20240318 09:20:02.941045 40524 deployment_tasks.cc:103] installation info exists. installation id: ec703055-85a0-417b-94a2-66e73948a602
I20240318 09:20:02.941049 40524 deployment_tasks.cc:114] sync dir: "E:\\code\\RimeSharp\\RimeSharp.Test\\bin\\Debug\\net8.0\\sync"
I20240318 09:20:02.941053 40524 deployment_tasks.cc:122] previous Rime version: 1.10.0
I20240318 09:20:02.941062 40524 deployer.cc:118] starting work thread for 3 tasks.
I20240318 09:20:02.941078 24560 deployer.cc:79] running deployment tasks:
I20240318 09:20:02.942674 24560 deployment_tasks.cc:165] updating workspace.
W20240318 09:20:02.942707 24560 config_data.cc:69] nonexistent config file '"E:\\code\\RimeSharp\\RimeSharp.Test\\bin\\Debug\\net8.0\\default.yaml"'.
I20240318 09:20:02.942855 24560 deployment_tasks.cc:394] missing build info
W20240318 09:20:02.942946 24560 config_data.cc:69] nonexistent config file '"E:\\code\\RimeSharp\\RimeSharp.Test\\bin\\Debug\\net8.0\\default.yaml"'.
I20240318 09:20:02.942952 24560 auto_patch_config_plugin.cc:29] auto-patch default:/__patch: default.custom:/patch?
W20240318 09:20:02.943006 24560 config_data.cc:69] nonexistent config file '"E:\\code\\RimeSharp\\RimeSharp.Test\\bin\\Debug\\net8.0\\default.yaml"'.
W20240318 09:20:02.943011 24560 deployment_tasks.cc:184] schema list not defined.
I20240318 09:20:02.943017 24560 deployment_tasks.cc:583] clean up trash.
I20240318 09:20:02.943081 24560 deployer.cc:96] 3 tasks ran: 2 success, 1 failure.
I20240318 09:20:02.943223 40524 config_data.cc:72] loading config file '"E:/code/RimeSharp/RimeSharp.Test/bin/Debug/net8.0/rime-pinyin-simp-master/pinyin_simp.schema.yaml"'.
W20240318 09:20:02.943581 40524 config_data.cc:69] nonexistent config file '"E:\\code\\RimeSharp\\RimeSharp.Test\\bin\\Debug\\net8.0\\pinyin_simp.schema.yaml"'.
I20240318 09:20:02.943610 40524 deployment_tasks.cc:394] missing build info
W20240318 09:20:02.943670 40524 config_data.cc:69] nonexistent config file '"E:\\code\\RimeSharp\\RimeSharp.Test\\bin\\Debug\\net8.0\\pinyin_simp.schema.yaml"'.
I20240318 09:20:02.943674 40524 auto_patch_config_plugin.cc:29] auto-patch pinyin_simp.schema:/__patch: pinyin_simp.custom:/patch?
W20240318 09:20:02.943689 40524 config_data.cc:69] nonexistent config file '"E:\\code\\RimeSharp\\RimeSharp.Test\\bin\\Debug\\net8.0\\pinyin_simp.schema.yaml"'.
设置问题,解决了