From b29836ed3bd518366047028bee2c3fbb6de0946a Mon Sep 17 00:00:00 2001 From: Dan Ballard Date: Wed, 20 Apr 2022 12:26:04 -0700 Subject: [PATCH 1/3] register uninstaller with windows add/remove programs --- windows/nsis/cwtch-installer.nsi | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/windows/nsis/cwtch-installer.nsi b/windows/nsis/cwtch-installer.nsi index a63ee737..d0288de3 100644 --- a/windows/nsis/cwtch-installer.nsi +++ b/windows/nsis/cwtch-installer.nsi @@ -96,10 +96,16 @@ Section WriteUninstaller "$INSTDIR\uninstall.exe" + # https://nsis.sourceforge.io/Add_uninstall_information_to_Add/Remove_Programs + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Cwtch" \ + "DisplayName" "Cwtch" + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Cwtch" \ + "UninstallString" "$\"$INSTDIR\uninstall.exe$\"" SectionEnd Section "Uninstall" RMDir /r /REBOOTOK "$INSTDIR" DeleteRegKey /ifempty HKCU "Software\Cwtch\installLocation" + DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\ImageMaker" SectionEnd \ No newline at end of file From a6c7682c84c444931b2253dd3eb843349b13f1aa Mon Sep 17 00:00:00 2001 From: Dan Ballard Date: Wed, 20 Apr 2022 14:25:36 -0700 Subject: [PATCH 2/3] nsis windows installer detect running, ask to not, abort --- windows/nsis/cwtch-installer.nsi | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/windows/nsis/cwtch-installer.nsi b/windows/nsis/cwtch-installer.nsi index d0288de3..a2406028 100644 --- a/windows/nsis/cwtch-installer.nsi +++ b/windows/nsis/cwtch-installer.nsi @@ -45,6 +45,17 @@ InstallDirRegKey HKCU "Software\Cwtch" "installLocation" ShowInstDetails show +; Init / make sure isn't running +; https://nsis.sourceforge.io/Check_whether_your_application_is_running + +Function .onInit +FindProcDLL::FindProc "Cwtch.exe" +StrCmp $R0 "1" found not_found +found: + MessageBox MB_ICONEXCLAMATION|MB_OK "Cwtch is still running, please exit it before running installer" /SD IDOK + Abort +not_found: + ; Pages -------- From a3d986d9d60d7faff0734b6d1c91482703428582 Mon Sep 17 00:00:00 2001 From: Dan Ballard Date: Wed, 20 Apr 2022 18:19:36 -0700 Subject: [PATCH 3/3] ffi on windows more options to detect tor; nsis installer warn about cwtch needing exiting --- lib/cwtch/ffi.dart | 8 +++++++- windows/nsis/cwtch-installer.nsi | 16 ++++------------ 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/lib/cwtch/ffi.dart b/lib/cwtch/ffi.dart index e0c583bc..34ba1f16 100644 --- a/lib/cwtch/ffi.dart +++ b/lib/cwtch/ffi.dart @@ -160,7 +160,13 @@ class CwtchFfi implements Cwtch { } } else if (Platform.isWindows) { cwtchDir = envVars['CWTCH_DIR'] ?? path.join(envVars['UserProfile']!, ".cwtch"); - bundledTor = "Tor\\Tor\\tor.exe"; + String currentTor = path.join(Directory.current.absolute.path, "Tor\\Tor\\tor.exe"); + if (await File(currentTor).exists()) { + bundledTor = currentTor; + } else { + String exeDir = path.dirname(Platform.resolvedExecutable); + bundledTor = path.join(exeDir, "Tor\\Tor\\tor.exe"); + } } else if (Platform.isMacOS) { cwtchDir = envVars['CWTCH_HOME'] ?? path.join(envVars['HOME']!, "Library/Application Support/Cwtch"); if (await File("Cwtch.app/Contents/MacOS/Tor/tor.real").exists()) { diff --git a/windows/nsis/cwtch-installer.nsi b/windows/nsis/cwtch-installer.nsi index a2406028..7e1eca30 100644 --- a/windows/nsis/cwtch-installer.nsi +++ b/windows/nsis/cwtch-installer.nsi @@ -45,23 +45,15 @@ InstallDirRegKey HKCU "Software\Cwtch" "installLocation" ShowInstDetails show -; Init / make sure isn't running -; https://nsis.sourceforge.io/Check_whether_your_application_is_running - -Function .onInit -FindProcDLL::FindProc "Cwtch.exe" -StrCmp $R0 "1" found not_found -found: - MessageBox MB_ICONEXCLAMATION|MB_OK "Cwtch is still running, please exit it before running installer" /SD IDOK - Abort -not_found: - ; Pages -------- !define MUI_WELCOMEPAGE_TITLE "Welcome to the Cwtch installer" !define MUI_WELCOMEPAGE_TEXT "Cwtch (pronounced: kutch) is a Welsh word roughly meaning 'a hug that creates a safe space'$\n$\n\ - Cwtch is a platform for building consentful, decentralized, untrusted infrastructure using metadata resistant group communication applications. Currently there is a selfnamed instant messaging prototype app that is driving development and testing. Many Further apps are planned as the platform matures." + Cwtch is a platform for building consentful, decentralized, untrusted infrastructure using metadata resistant group communication applications. Currently there is a selfnamed instant messaging prototype app that is driving development and testing. Many Further apps are planned as the platform matures.$\n$\n\ + Please close any running copies of Cwtch before installing a new version." + +; Detecting if Cwtch is running and reminding the user or closing it appears to require 3rd party plugins that take the form of decade+ old .dlls in zips from a wiki... !define MUI_FINISHPAGE_TITLE "Enjoy Cwtch" !define MUI_FINISHPAGE_RUN $INSTDIR/cwtch.exe