mirror of
https://github.com/debpalash/VoiceStudio.git
synced 2026-12-04 09:28:22 +00:00
- Background launches keep the launcher's switches, so Snap's --no-sandbox reaches Electron and the app can start confined. - A crashed backend fails fast instead of waiting out the startup budget. - The AUR launcher runs the renamed executable, and package-managed installs (VOICESTUDIO_DISABLE_UPDATER=1) are told to update through their package manager instead of opening a disabled updater. - Windows: PATH is edited in the registry as stored (unexpanded entries, same value type); the warning never blocks a silent install; an update keeps the PATH entry in case it rolls back. - Relative command links are resolved against their own folder, and bash users with ~/.bash_profile get the PATH entry there. - Settings shows a translated, actionable message when PATH setup fails. - Tests: the network guard also blocks connect_ex and sendto; the lock tests synchronize on events instead of sleeps and kill the holder to test a real crash; a Windows path assertion is separator-agnostic.
44 lines
2.1 KiB
PowerShell
44 lines
2.1 KiB
PowerShell
# Called by NSIS; add/remove only the command directory owned by this installation.
|
|
# PATH is edited in the registry as stored: %SystemRoot%-style entries stay
|
|
# unexpanded and the value keeps its type ([Environment]::SetEnvironmentVariable
|
|
# would expand every entry and rewrite the value as a plain string).
|
|
param([ValidateSet('Install', 'Uninstall')][string]$Action,
|
|
[ValidateSet('User', 'Machine')][string]$Scope = 'User',
|
|
# Tests point this at a scratch key under HKCU; installers never pass it.
|
|
[string]$TestKey = '')
|
|
$ErrorActionPreference = 'Stop'
|
|
$commandDir = [IO.Path]::GetFullPath($PSScriptRoot)
|
|
if ($TestKey) {
|
|
$key = [Microsoft.Win32.Registry]::CurrentUser.CreateSubKey($TestKey)
|
|
} elseif ($Scope -eq 'Machine') {
|
|
$key = [Microsoft.Win32.Registry]::LocalMachine.OpenSubKey(
|
|
'SYSTEM\CurrentControlSet\Control\Session Manager\Environment', $true)
|
|
} else {
|
|
$key = [Microsoft.Win32.Registry]::CurrentUser.CreateSubKey('Environment')
|
|
}
|
|
try {
|
|
$current = [string]$key.GetValue('Path', '',
|
|
[Microsoft.Win32.RegistryValueOptions]::DoNotExpandEnvironmentNames)
|
|
$kind = [Microsoft.Win32.RegistryValueKind]::ExpandString
|
|
if ($key.GetValueNames() -contains 'Path') { $kind = $key.GetValueKind('Path') }
|
|
$entries = @($current -split ';' | Where-Object { $_ -and $_.TrimEnd('\') -ine $commandDir.TrimEnd('\') })
|
|
if ($Action -eq 'Install') { $entries = @($commandDir) + $entries }
|
|
$key.SetValue('Path', ($entries -join ';'), $kind)
|
|
} finally {
|
|
$key.Close()
|
|
}
|
|
if ($TestKey) { exit 0 }
|
|
# Notify Explorer so newly opened terminals inherit the updated PATH.
|
|
Add-Type @'
|
|
using System;
|
|
using System.Runtime.InteropServices;
|
|
public static class VoiceStudioEnvironment {
|
|
[DllImport("user32.dll", CharSet = CharSet.Unicode, SetLastError = true)]
|
|
public static extern IntPtr SendMessageTimeout(IntPtr window, uint message,
|
|
UIntPtr wParam, string lParam, uint flags, uint timeout, out UIntPtr result);
|
|
}
|
|
'@
|
|
$result = [UIntPtr]::Zero
|
|
[void][VoiceStudioEnvironment]::SendMessageTimeout([IntPtr]0xffff, 0x1a,
|
|
[UIntPtr]::Zero, 'Environment', 2, 5000, [ref]$result)
|