-
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
Changes from 4 commits
1a3ec32
2f0ead1
1196001
7903168
ebb598e
844981e
83dabea
7d8e3a8
a8cabfe
085f60e
88de9f4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -43,7 +43,12 @@ 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())) { | ||
#ifdef WIN32 | ||
LOG(INFO) << "creating new file '" << custom_config_file(config_id_).c_str() << "'."; | ||
std::ofstream out{ custom_config_path.string(), std::ios::app }; | ||
#else | ||
return false; | ||
#endif | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 commentThe 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 commentThe 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 commentThe reason will be displayed to describe this comment to others. Learn more. 在网页上改的,有时候空格没注意到。文件当时是本机编译的,环境变量不太一样,用github同步时会冲突,只网页上修改了相关的代码片断。 |
||
modified_ = false; | ||
return true; | ||
|
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 的方法来实现,这样就不用自己费劲写了:
https://github.com/BYVoid/OpenCC/blob/5750d92a92ac1f2d64c880c1f6f1a5e382d7d199/src/UTF8Util.hpp#L256-L289
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字符串。