-
Notifications
You must be signed in to change notification settings - Fork 557
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
opencc中文路径问题 #654
opencc中文路径问题 #654
Conversation
修复Windows下opencc中文路径问题
在64位项目中引用时,需要使会话ID统一大小,由于底层传上来的是指针,32位程序要使用UINT64来保存它,这里要将类型统一,否则模板就匹配不上。
修复opencc对中文路径的支持
修复Win平台用户目录中缺少「default.custom.yaml」、「weasel.custom.yaml」两个文件时,设定窗口无法打开
Windows平台下首次安装时,用户目录里没有「default.custom.yaml」、「weasel.custom.yaml」两个文件,设定窗口无法打开。目前测试,Windows平台可正常运行修改过的代码。 |
src/rime/gear/simplifier.cc
Outdated
@@ -36,7 +40,21 @@ class Opencc { | |||
LOG(INFO) << "initializing opencc: " << config_path; | |||
opencc::Config config; | |||
try { | |||
#ifdef WIN32 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
建议把这段提炼成单个方法,方便其他地方引用
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
或者也可以使用 OpenCC 的方法来实现,这样就不用自己费劲写了:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
似乎只有Windows平台使用多字节字符串路径,这个转换只有opencc会用到,别的地方用不到了。其它平台在这里传入的是utf8,Windows平台传入的却是多字节,而opencc要求必须传入utf8字符串。
Windows下的opencc中文路径识别
src/rime/lever/custom_settings.cc
Outdated
@@ -43,7 +43,7 @@ bool CustomSettings::Load() { | |||
fs::path custom_config_path = | |||
fs::path(deployer_->user_data_dir) / custom_config_file(config_id_); | |||
if (!custom_config_.LoadFromFile(custom_config_path.string())) { | |||
return false; | |||
return false; | |||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
之前是改过的。但梁大说这两个文件在Weasel端创建,librime是几个平台共用的库,不应该创建平台相关的文件。所以就删除了。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sorry, 我的意思是行尾不应该多个空格, 让你困扰了。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
在网页上改的,有时候空格没注意到。文件当时是本机编译的,环境变量不太一样,用github同步时会冲突,只网页上修改了相关的代码片断。
Closing in favor of #689 |
修复Windows下用户词库所在路径包含中文的问题。