File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 5050 " icons/icon.ico" ,
5151 " icons/icon.png"
5252 ],
53+ "windows" : {
54+ "nsis" : {
55+ "installerHooks" : " windows/nsis-hooks.nsh"
56+ }
57+ },
5358 "macOS" : {
5459 "entitlements" : " Entitlements.plist"
5560 }
Original file line number Diff line number Diff line change 1+ use std:: { fs, path:: Path } ;
2+
3+ #[ test]
4+ fn nsis_hook_deletes_sessionview_data_only_when_requested ( ) {
5+ let manifest_dir = Path :: new ( env ! ( "CARGO_MANIFEST_DIR" ) ) ;
6+ let config_path = manifest_dir. join ( "tauri.conf.json" ) ;
7+ let config: serde_json:: Value =
8+ serde_json:: from_str ( & fs:: read_to_string ( & config_path) . expect ( "read tauri.conf.json" ) )
9+ . expect ( "parse tauri.conf.json" ) ;
10+
11+ let hook_relative = config
12+ . pointer ( "/bundle/windows/nsis/installerHooks" )
13+ . and_then ( serde_json:: Value :: as_str)
14+ . expect ( "NSIS installer hook must be configured" ) ;
15+ let hook = fs:: read_to_string ( manifest_dir. join ( hook_relative) ) . expect ( "read NSIS hook" ) ;
16+ let commands: Vec < & str > = hook
17+ . lines ( )
18+ . map ( str:: trim)
19+ . filter ( |line| !line. is_empty ( ) && !line. starts_with ( ';' ) )
20+ . collect ( ) ;
21+
22+ assert_eq ! (
23+ commands,
24+ [
25+ "!macro NSIS_HOOK_POSTUNINSTALL" ,
26+ "${If} $DeleteAppDataCheckboxState = 1" ,
27+ "${AndIf} $UpdateMode <> 1" ,
28+ "RMDir /r \" $LOCALAPPDATA\\ sessionview\" " ,
29+ "${EndIf}" ,
30+ "!macroend" ,
31+ ]
32+ ) ;
33+ }
Original file line number Diff line number Diff line change 1+ ; SessionView stores its database and image cache in
2+ ; %LOCALAPPDATA%\sessionview instead of Tauri's bundle-identifier directory.
3+ ; Match Tauri's built-in "Delete application data" behavior for that legacy
4+ ; location without deleting data during updates or unconfirmed uninstalls.
5+ !macro NSIS_HOOK_POSTUNINSTALL
6+ ${If} $DeleteAppDataCheckboxState = 1
7+ ${AndIf} $UpdateMode <> 1
8+ RMDir /r " $LOCALAPPDATA\sessionview"
9+ ${EndIf}
10+ !macroend
You can’t perform that action at this time.
0 commit comments