-
-
Notifications
You must be signed in to change notification settings - Fork 257
re-fix rust #292
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
re-fix rust #292
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
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.
辛苦了👍👍👍
我建议拆分提交,尤其是一些通用功能的实现,应该单独提出来。
完全靠字符串去分析 rust 的配置文件,我觉得是非常辛苦的,也很难维护。以后用 我们已经用C语言实现了很多其实和 我想,C语言实现的 我认为,提示用户进行简单的手动操作,就是把 如果非要坚持全自动换源,用其他语言重写可能是唯一的出路,如果是我,我可能会选择 Go 来重写,这是纯粹的从软件工程的角度来讨论的,从减少维护量来讨论的。然而我不喜欢 Go 语言,这让我对重写 |
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
ffa14b4
to
57f7249
Compare
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as off-topic.
This comment was marked as off-topic.
|
现在的能跑通了吗?我没有环境验证。 |
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as outdated.
This comment was marked as outdated.
测试均已通过,我认为可以merge了 |
增加前缀避免命名冲突
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.
另外再看一下 #294 的问题
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.
👍👍👍 辛苦了 @Mikachu2333
问题描述
sed
和grep
),且也没有原来的 doc 了sed
和grep
在win上也不能正确运行,正则似乎是写错了(不太确定),反正换源换成一坨乱码了方案与实现
fw.c
中修改的测试步骤)xy.h
xy.h 增加str类的通用函数 #293xy_str_find
用于查找str子串并返回 (bool, pos_begin, pos_end)xy_str_take_until_newline
与上面的函数结合使用,用于获取从传入字符串的[0]
开始直到下一个换行符的所有字符,主要在提取配置时使用xy_file_to_str
用于读取文件并返回全部内容(以字符串形式返回),已处理所有换行符为\n
core.c
core.c 修改函数实现 #294chsrc_log_overwrite
对覆写特别设置chsrc_log_backup
chsrc_prepend_to_file
impl for wincargo.c
pl_note_get_src_default
把部分重复的通知逻辑抽出来了pl_note_get_src_mirror
略pl_rust_cargo_getsrc
sed
/grep
的代码pl_write_rust_config
把重复的逻辑抽出来了pl_rust_cargo_getsrc
用了很笨的办法,读取文件 -> 查找字段 -> 手动获取有效信息 -> 手动格式化,好消息是对所有系统都适用,因为mirror必须按官方规范来否则rust不识别,所以“获取有效信息”和“格式化”这两步也没啥额外问题,感觉现在错误处理有些太繁琐了,似乎可以精简rustup.c
格式化rawstr4c.h
删除无用数据fw.c
core.c 修改函数实现 #294其它
chsrc_prepend_to_file
(Impl for win) 并且暂未发现问题。