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