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

配置文件硬链接问题 #494

Closed
wsw0108 opened this Issue Jun 14, 2017 · 3 comments

Comments

Projects
None yet
3 participants
@wsw0108

wsw0108 commented Jun 14, 2017

重现步骤

  • 第一次启动程序,生成了 config.ini
  • config.ini 改名为 config.ini.real
  • 打开 cmd 创建硬链接, mklink /h config.ini config.ini.real
  • 打开 Git Bash, ls -l, 显示 config.ini/config.ini.real 的链接数为 2
  • 通过程序界面, 随便修改一个配置项, 比如快捷键设置

结果

  • config.ini 的内容相应改变
  • config.ini.real 的内容和 config.ini 的不一样
  • 通过 Git Bash 查看, 链接数变为 1, 也就是说, 硬链接丢失了

期望

  • config.ini 的内容相应改变
  • config.ini.real 的内容和 config.ini 的一样
  • 通过 Git Bash 查看的话, 链接数依然是 2
@taroxd

This comment has been minimized.

taroxd commented Jun 14, 2017

@wsw0108 配置文件应该是直接写入文件的。要把配置文件放在其他地方,可以考虑使用命令行选项
--config

@wsw0108

This comment has been minimized.

wsw0108 commented Jun 14, 2017

@taroxd 谢谢提醒还有这个参数.

不过这主要是为了这个的persist的用途, https://github.com/lukesampson/scoop-extras/blob/master/snipaste.json#L15

scoop目前不支持在创建快捷方式时指定程序参数.

Snipaste更新配置文件时, 硬链接就丢失了, 严格来说是个问题.
我猜有可能是通过文件重命名方式来更新的?

@liulex

This comment has been minimized.

Member

liulex commented Jun 14, 2017

@wsw0108 确实是通过改名的方式来更新的(QSettings)。
硬链接我没想到好的办法,不过如果使用软链接(symbolic link)就容易修,即使用:
mklink config.ini config.ini.real
不知这个是否可以接受?

或者这样,如果 config.ini 里包含配置项 config=\path\to\another\config.ini,就自动转为读取另一个配置文件,这样程序目录下的 config.ini 就可以只包含一项并且保持文件不变,配置实际存储在另一个指定文件里。

@liulex liulex added this to the 1.14 milestone Jul 23, 2017

@liulex liulex added the feature label Jul 23, 2017

@liulex liulex closed this Jul 23, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment