Skip to content

Commit 2b9970c

Browse files
committed
fluxdown: Switch to Copy-based persist pattern
- Use pre_install/pre_uninstall copy-in/copy-out for flux_down.db and settings.json (app rewrites these files, breaking hardlinks) - Keep bt_session and logs in persist (directories, junction works) - Use $version variable in CLI note URL
1 parent d835a3b commit 2b9970c

1 file changed

Lines changed: 19 additions & 5 deletions

File tree

bucket/fluxdown.json

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
" Edge: https://microsoftedge.microsoft.com/addons/detail/fluxdown/nglkkjbogjghekbhhcnccnpfedjbdhhd",
2222
"",
2323
"Command-line client:",
24-
" https://github.com/zerx-lab/FluxDown/releases/tag/cli-v0.2.1"
24+
" https://github.com/zerx-lab/FluxDown/releases/tag/cli-v$version"
2525
],
2626
"architecture": {
2727
"64bit": {
@@ -34,19 +34,33 @@
3434
}
3535
},
3636
"pre_install": [
37-
"if (!(Test-Path \"$dir\\flux_down.db\")) { New-Item -ItemType File \"$dir\\flux_down.db\" -Force | Out-Null }",
38-
"if (!(Test-Path \"$dir\\settings.json\")) { Set-Content \"$dir\\settings.json\" '{}' -Encoding UTF8 }"
37+
"'flux_down.db', 'settings.json' | ForEach-Object {",
38+
" if (Test-Path \"$persist_dir\\$_\") {",
39+
" Copy-Item \"$persist_dir\\$_\" \"$dir\\$_\" -Force",
40+
" } else {",
41+
" if ($_ -eq 'flux_down.db') {",
42+
" New-Item -ItemType File \"$dir\\$_\" -Force | Out-Null",
43+
" } else {",
44+
" Set-Content \"$dir\\$_\" '{}' -Encoding UTF8",
45+
" }",
46+
" }",
47+
"}"
3948
],
4049
"shortcuts": [
4150
[
4251
"flux_down.exe",
4352
"FluxDown"
4453
]
4554
],
55+
"pre_uninstall": [
56+
"'flux_down.db', 'settings.json' | ForEach-Object {",
57+
" if (Test-Path \"$dir\\$_\") {",
58+
" Copy-Item \"$dir\\$_\" \"$persist_dir\\$_\" -Force",
59+
" }",
60+
"}"
61+
],
4662
"persist": [
47-
"flux_down.db",
4863
"bt_session",
49-
"settings.json",
5064
"logs"
5165
],
5266
"checkver": {

0 commit comments

Comments
 (0)