Extras icon indicating copy to clipboard operation
Extras copied to clipboard

syncthingtray: fix config persist

Open qianlongzt opened this issue 1 year ago • 1 comments

fix config file syncthingtray.ini persist

qianlongzt avatar Oct 16 '24 07:10 qianlongzt

All changes look good.

Wait for review from human collaborators.

syncthingtray

  • [x] Description
  • [x] License
  • [x] Hashes
  • [x] Checkver
  • [x] Autoupdate

github-actions[bot] avatar Oct 16 '24 07:10 github-actions[bot]

I think what's preferable is making a symlink. The below part could be put into pre_install:

"$config = \"syncthingtray.ini\"",
"if (!(Test-Path \"$persist_dir\\$config\")) { New-Item \"$persist_dir\\$config\" -ItemType File | Out-Null }",
"New-Item -Type SymbolicLink -Value $persist_dir\\$config -Path $dir\\$config | Out-Null"

You could then remove the post_install and pre_uninstall parts. I also don't think the "ensure" things are necessary (in that case).

Higramx avatar Oct 25 '24 03:10 Higramx

Yes, I tested the symlink, and it works correctly. It does not delete the symlink; it deletes the target file and recreates it in the target location. ensure is still necessary, or an error might occur.

But symlink need administrator privilege

image

qianlongzt avatar Oct 25 '24 06:10 qianlongzt

Does persist not require admin privilege? I have not tested without.

Higramx avatar Oct 25 '24 07:10 Higramx

hard link and junction: normal user symlink: admin or enable developer mode

https://github.com/ScoopInstaller/Scoop/blob/859d1db51bcc840903d5280567846ae2f7207ca2/lib/diagnostic.ps1#L59

qianlongzt avatar Oct 25 '24 07:10 qianlongzt

ok thanks

Higramx avatar Oct 25 '24 07:10 Higramx

/verify

aliesbelik avatar Nov 17 '24 23:11 aliesbelik

All changes look good.

Wait for review from human collaborators.

syncthingtray

  • [x] Description
  • [x] License
  • [x] Hashes
  • [x] Checkver
  • [x] Autoupdate

github-actions[bot] avatar Nov 17 '24 23:11 github-actions[bot]