60 verifyDesktopShortcut(); |
60 verifyDesktopShortcut(); |
61 verifyFileAssociationsRegistry(); |
61 verifyFileAssociationsRegistry(); |
62 } |
62 } |
63 |
63 |
64 private void verifyDesktopShortcut() { |
64 private void verifyDesktopShortcut() { |
65 boolean appInstalled = cmd.launcherInstallationPath().toFile().exists(); |
65 boolean appInstalled = cmd.appLauncherPath().toFile().exists(); |
66 if (cmd.hasArgument("--win-shortcut")) { |
66 if (cmd.hasArgument("--win-shortcut")) { |
67 if (isUserLocalInstall(cmd)) { |
67 if (isUserLocalInstall(cmd)) { |
68 verifyUserLocalDesktopShortcut(appInstalled); |
68 verifyUserLocalDesktopShortcut(appInstalled); |
69 verifySystemDesktopShortcut(false); |
69 verifySystemDesktopShortcut(false); |
70 } else { |
70 } else { |
100 queryRegistryValueCache(USER_SHELL_FOLDERS_REGKEY, "Desktop")); |
100 queryRegistryValueCache(USER_SHELL_FOLDERS_REGKEY, "Desktop")); |
101 verifyShortcut(dir.resolve(desktopShortcutPath()), exists); |
101 verifyShortcut(dir.resolve(desktopShortcutPath()), exists); |
102 } |
102 } |
103 |
103 |
104 private void verifyStartMenuShortcut() { |
104 private void verifyStartMenuShortcut() { |
105 boolean appInstalled = cmd.launcherInstallationPath().toFile().exists(); |
105 boolean appInstalled = cmd.appLauncherPath().toFile().exists(); |
106 if (cmd.hasArgument("--win-menu")) { |
106 if (cmd.hasArgument("--win-menu")) { |
107 if (isUserLocalInstall(cmd)) { |
107 if (isUserLocalInstall(cmd)) { |
108 verifyUserLocalStartMenuShortcut(appInstalled); |
108 verifyUserLocalStartMenuShortcut(appInstalled); |
109 verifySystemStartMenuShortcut(false); |
109 verifySystemStartMenuShortcut(false); |
110 } else { |
110 } else { |
120 private Path startMenuShortcutPath() { |
120 private Path startMenuShortcutPath() { |
121 return Path.of(cmd.getArgumentValue("--win-menu-group", |
121 return Path.of(cmd.getArgumentValue("--win-menu-group", |
122 () -> "Unknown"), cmd.name() + ".lnk"); |
122 () -> "Unknown"), cmd.name() + ".lnk"); |
123 } |
123 } |
124 |
124 |
|
125 private void verifyStartMenuShortcut(Path shortcutsRoot, boolean exists) { |
|
126 Path shortcutPath = shortcutsRoot.resolve(startMenuShortcutPath()); |
|
127 verifyShortcut(shortcutPath, exists); |
|
128 if (!exists) { |
|
129 TKit.assertPathExists(shortcutPath.getParent(), false); |
|
130 } |
|
131 } |
|
132 |
125 private void verifySystemStartMenuShortcut(boolean exists) { |
133 private void verifySystemStartMenuShortcut(boolean exists) { |
126 Path dir = Path.of(queryRegistryValueCache( |
134 verifyStartMenuShortcut(Path.of(queryRegistryValueCache( |
127 SYSTEM_SHELL_FOLDERS_REGKEY, "Common Programs")); |
135 SYSTEM_SHELL_FOLDERS_REGKEY, "Common Programs")), exists); |
128 verifyShortcut(dir.resolve(startMenuShortcutPath()), exists); |
136 |
129 } |
137 } |
130 |
138 |
131 private void verifyUserLocalStartMenuShortcut(boolean exists) { |
139 private void verifyUserLocalStartMenuShortcut(boolean exists) { |
132 Path dir = Path.of(queryRegistryValueCache( |
140 verifyStartMenuShortcut(Path.of(queryRegistryValueCache( |
133 USER_SHELL_FOLDERS_REGKEY, "Programs")); |
141 USER_SHELL_FOLDERS_REGKEY, "Programs")), exists); |
134 verifyShortcut(dir.resolve(startMenuShortcutPath()), exists); |
|
135 } |
142 } |
136 |
143 |
137 private void verifyFileAssociationsRegistry() { |
144 private void verifyFileAssociationsRegistry() { |
138 Stream.of(cmd.getAllArgumentValues("--file-associations")).map( |
145 Stream.of(cmd.getAllArgumentValues("--file-associations")).map( |
139 Path::of).forEach(this::verifyFileAssociationsRegistry); |
146 Path::of).forEach(this::verifyFileAssociationsRegistry); |
140 } |
147 } |
141 |
148 |
142 private void verifyFileAssociationsRegistry(Path faFile) { |
149 private void verifyFileAssociationsRegistry(Path faFile) { |
143 boolean appInstalled = cmd.launcherInstallationPath().toFile().exists(); |
150 boolean appInstalled = cmd.appLauncherPath().toFile().exists(); |
144 try { |
151 try { |
145 TKit.trace(String.format( |
152 TKit.trace(String.format( |
146 "Get file association properties from [%s] file", |
153 "Get file association properties from [%s] file", |
147 faFile)); |
154 faFile)); |
148 Map<String, String> faProps = Files.readAllLines(faFile).stream().filter( |
155 Map<String, String> faProps = Files.readAllLines(faFile).stream().filter( |