Skip to content

Private AI meeting notes that stay on your computer. No meeting bot. Free and open source for Mac, Windows and Linux. An alternative to Granola, Otter and Fireflies.

Windows installer: choose where Yogurt installs and where its AI models go (#88)

Christian Mathiesen37d791e1dfc4
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index ed06909a..15503c9b 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -134,6 +134,34 @@ jobs:
run: |
cd app
if [ "$RUNNER_OS" = "Linux" ]; then xvfb-run -a pnpm exec playwright test --grep @everywhere; else pnpm exec playwright test --grep @everywhere; fi
+ # Windows: the real installer, clicked through page by page (custom install and models folders), then updated
+ # over silently the way the app does it, then with the defaults (scripts/windows-installer-check.py)
+ - name: Package the installer (Windows)
+ if: runner.os == 'Windows'
+ shell: bash
+ env:
+ CSC_IDENTITY_AUTO_DISCOVERY: 'false'
+ run: |
+ mkdir -p app/resources/vad
+ cd app && pnpm exec electron-builder --win --publish never -c.extraMetadata.yogurtPreview=true
+ - uses: actions/setup-python@v5
+ if: runner.os == 'Windows'
+ with:
+ python-version: '3.12'
+ - name: Click through the installer (Windows)
+ if: runner.os == 'Windows'
+ timeout-minutes: 25
+ run: |
+ python -m pip install --quiet pywinauto==0.6.9 pillow==11.1.0
+ python app/scripts/windows-installer-check.py app/dist/Yogurt-windows-x64.exe installer-pages
+ - name: Keep the installer's pages
+ if: always() && runner.os == 'Windows'
+ uses: actions/upload-artifact@v4
+ with:
+ name: windows-installer-pages
+ path: installer-pages
+ if-no-files-found: ignore
+ retention-days: 14
- name: Keep the test report
if: failure()
uses: actions/upload-artifact@v4
diff --git a/app/build/installer.nsh b/app/build/installer.nsh
index 11e42d9c..d84bc8cc 100644
--- a/app/build/installer.nsh
+++ b/app/build/installer.nsh
@@ -24,3 +24,79 @@
${EndIf}
ClearErrors
!macroend
+
+; After the install folder, a page asks where to keep the AI models (5 to 12 GB), so a small C: drive
+; isn't filled. The answer goes to %APPDATA%\Yogurt\models-dir.txt, which the app reads (src/main/paths.ts modelsFolder).
+; Not asked on updates (silent), or when models are already somewhere: nothing is ever moved.
+!include nsDialogs.nsh
+
+; An installer with pages would first ask "Anyone who uses this computer" or "Only for me"; the first needs an admin.
+; Yogurt is always installed just for this person (perMachine: false), so that page is skipped.
+!macro customInstallMode
+ StrCpy $isForceCurrentInstall "1"
+!macroend
+
+!ifndef BUILD_UNINSTALLER
+Var ModelsDir
+Var ModelsField
+
+Function modelsPageCreate
+ ${If} ${Silent}
+ Abort
+ ${EndIf}
+ ${If} ${FileExists} "$APPDATA\Yogurt\models-dir.txt"
+ Abort
+ ${EndIf}
+ ${If} ${FileExists} "$APPDATA\Yogurt\models\*.*"
+ Abort
+ ${EndIf}
+ StrCpy $ModelsDir "$APPDATA\Yogurt\models"
+ ; the heading above the page (MUI2 isn't loaded yet where this file is included, so set directly)
+ GetDlgItem $0 $HWNDPARENT 1037
+ SendMessage $0 ${WM_SETTEXT} 0 "STR:Choose where the AI models go"
+ GetDlgItem $0 $HWNDPARENT 1038
+ SendMessage $0 ${WM_SETTEXT} 0 "STR:They're big, so pick a drive with space."
+ nsDialogs::Create 1018
+ Pop $0
+ ${NSD_CreateLabel} 0 0 100% 36u "Yogurt downloads its AI models once, about 5 to 12 GB. Choose where to keep them. A drive with room to spare is best."
+ Pop $0
+ ${NSD_CreateDirRequest} 0 44u 76% 13u "$ModelsDir"
+ Pop $ModelsField
+ ${NSD_CreateBrowseButton} 78% 43u 22% 15u "Browse..."
+ Pop $0
+ ${NSD_OnClick} $0 modelsBrowse
+ nsDialogs::Show
+FunctionEnd
+
+Function modelsBrowse
+ ${NSD_GetText} $ModelsField $0
+ nsDialogs::SelectFolderDialog "Folder for Yogurt's AI models" "$0"
+ Pop $0
+ ${If} $0 != error
+ ${NSD_SetText} $ModelsField "$0"
+ ${EndIf}
+FunctionEnd
+
+Function modelsPageLeave
+ ${NSD_GetText} $ModelsField $ModelsDir
+ ${If} $ModelsDir == ""
+ ${OrIf} $ModelsDir == "$APPDATA\Yogurt\models"
+ Return
+ ${EndIf}
+ CreateDirectory "$ModelsDir"
+ ${IfNot} ${FileExists} "$ModelsDir\*.*"
+ MessageBox MB_ICONEXCLAMATION "Yogurt can't use that folder. Pick another one."
+ Abort
+ ${EndIf}
+ CreateDirectory "$APPDATA\Yogurt"
+ ; UTF-16 with a byte-order mark, so any folder name survives
+ FileOpen $0 "$APPDATA\Yogurt\models-dir.txt" w
+ FileWriteWord $0 0xFEFF
+ FileWriteUTF16LE $0 "$ModelsDir"
+ FileClose $0
+FunctionEnd
+!endif
+
+!macro customPageAfterChangeDir
+ Page custom modelsPageCreate modelsPageLeave
+!macroend
diff --git a/app/electron-builder.yml b/app/electron-builder.yml
index 9ca2b597..fa64dfaf 100644
--- a/app/electron-builder.yml
+++ b/app/electron-builder.yml
@@ -112,8 +112,12 @@ win:
arch: [x64]
icon: build/icon.png
nsis:
- oneClick: true
- # carries on when an update's old uninstaller fails (#126)
+ # an installer with pages (not one click): where Yogurt goes, then where its AI models go (build/installer.nsh), for a
+ # small C: drive. Still per user, no admin prompt; updates install silently as before. The include also carries on
+ # when an update's old uninstaller fails (#126)
+ oneClick: false
+ allowToChangeInstallationDirectory: true
+ allowElevation: false
include: build/installer.nsh
perMachine: false
# never true: uninstalling would delete every meeting, transcript and recording with the models
diff --git a/app/scripts/windows-installer-check.py b/app/scripts/windows-installer-check.py
new file mode 100644
index 00000000..1738ae46
--- /dev/null
+++ b/app/scripts/windows-installer-check.py
@@ -0,0 +1,258 @@
+# CI (Windows): click through the real installer like a person would, then update over it silently like the app does.
+# python scripts/windows-installer-check.py dist/Yogurt-windows-x64.exe <screenshots folder>
+# 1. custom install folder and models folder, chosen on the pages; 2. a silent update over it (no pages, nothing moved);
+# 3. the installed app (fake mode, nothing downloaded) looks for its models in the chosen folder;
+# 4. a fresh install with the defaults; 5. models already there: the models page is skipped.
+import os, re, shutil, subprocess, sys, threading, time, winreg
+from pathlib import Path
+
+from PIL import ImageGrab
+from pywinauto import Desktop
+
+INSTALLER = Path(sys.argv[1]).resolve()
+SHOTS = Path(sys.argv[2]).resolve()
+SHOTS.mkdir(parents=True, exist_ok=True)
+APP_DIR = Path(r'C:\YogurtTest\app')
+MODELS = Path(r'C:\YogurtModels')
+PROFILE = Path(os.environ['APPDATA']) / 'Yogurt'
+DEFAULT_APP_DIR = Path(os.environ['LOCALAPPDATA']) / 'Programs' / 'Yogurt'
+UNINSTALL = r'Software\Microsoft\Windows\CurrentVersion\Uninstall'
+
+results: list[tuple[str, bool]] = []
+shot_n = 0
+
+
+def check(name: str, ok: bool, detail: object = '') -> None:
+ results.append((name, bool(ok)))
+ print(f"{'PASS' if ok else 'FAIL'} {name} {detail}", flush=True)
+
+
+def screenshot(name: str, win=None) -> None:
+ global shot_n
+ shot_n += 1
+ path = SHOTS / f'{shot_n:02d}-{name}.png'
+ try:
+ if win is not None:
+ try: win.set_focus()
+ except Exception: pass
+ time.sleep(0.4)
+ win.capture_as_image().save(path)
+ else:
+ ImageGrab.grab().save(path)
+ except Exception as e:
+ print('screenshot failed, whole screen instead:', e)
+ ImageGrab.grab().save(path)
+
+
+def setup_windows() -> list:
+ return [w for w in Desktop(backend='win32').windows(class_name='#32770', visible_only=True) if 'Yogurt' in w.window_text()]
+
+
+def page_text(win) -> str:
+ return ' | '.join(c.window_text() for c in win.descendants() if c.is_visible() and c.window_text())
+
+
+def wait(what: str, fn, timeout: float = 180):
+ end = time.time() + timeout
+ while time.time() < end:
+ try:
+ v = fn()
+ if v: return v
+ except Exception:
+ pass
+ time.sleep(0.5)
+ screenshot(f'timeout-{re.sub(r"[^a-z]+", "-", what.lower())}')
+ raise TimeoutError(what)
+
+
+def wait_page(win, needle: str, timeout: float = 180) -> str:
+ return wait(f'page with {needle}', lambda: (t := page_text(win)) and needle in t and t, timeout)
+
+
+def click_next(win) -> None:
+ # the window's own Next / Install / Finish button (id 1), not one on the page inside it
+ next(c for c in win.children() if c.class_name() == 'Button' and c.control_id() == 1).click()
+
+
+def visible_edit(win):
+ return next(c for c in win.descendants(class_name='Edit') if c.is_visible())
+
+
+def read_models_txt() -> str | None:
+ f = PROFILE / 'models-dir.txt'
+ if not f.exists(): return None
+ raw = f.read_bytes()
+ return (raw[2:].decode('utf-16-le') if raw[:2] == b'\xff\xfe' else raw.decode('utf-8')).strip()
+
+
+def uninstall_entries(root) -> list[dict]:
+ out = []
+ for view in (winreg.KEY_WOW64_64KEY, winreg.KEY_WOW64_32KEY):
+ try: key = winreg.OpenKey(root, UNINSTALL, 0, winreg.KEY_READ | view)
+ except OSError: continue
+ for i in range(winreg.QueryInfoKey(key)[0]):
+ try:
+ sub = winreg.OpenKey(key, winreg.EnumKey(key, i))
+ name = winreg.QueryValueEx(sub, 'DisplayName')[0]
+ except OSError:
+ continue
+ if str(name).startswith('Yogurt'):
+ # electron-builder leaves InstallLocation out: the uninstaller's path says where it is
+ try: un = winreg.QueryValueEx(sub, 'UninstallString')[0]
+ except OSError: un = ''
+ m = re.match(r'"([^"]+)"', un)
+ entry = {'name': name, 'location': str(Path(m.group(1)).parent) if m else ''}
+ if entry not in out: out.append(entry)
+ return out
+
+
+class ConsentWatch:
+ """Notes any UAC prompt (consent.exe) while the installer runs."""
+ def __init__(self) -> None:
+ self.seen = False
+ self.stop = False
+ threading.Thread(target=self.run, daemon=True).start()
+
+ def run(self) -> None:
+ while not self.stop:
+ out = subprocess.run(['tasklist', '/FI', 'IMAGENAME eq consent.exe', '/NH'], capture_output=True, text=True).stdout
+ if 'consent.exe' in out.lower(): self.seen = True
+ time.sleep(0.5)
+
+
+def run_app_and_read_models_dir() -> str | None:
+ """The installed app in fake mode (nothing downloaded): its log says where it looks for the models."""
+ log = PROFILE / 'logs' / 'main.log'
+ before = log.read_text(encoding='utf-8', errors='replace') if log.exists() else ''
+ exe = next(p for p in (APP_DIR / 'Yogurt.exe', DEFAULT_APP_DIR / 'Yogurt.exe') if p.exists())
+ env = {**os.environ, 'YOGURT_FAKE': '1'}
+ proc = subprocess.Popen([str(exe)], env=env)
+ try:
+ def found():
+ text = log.read_text(encoding='utf-8', errors='replace') if log.exists() else ''
+ m = re.findall(r'MODELS dir=(.+)', text[len(before):])
+ return m[-1].strip() if m else None
+ return wait('the app logs its models folder', found, 90)
+ finally:
+ time.sleep(3)
+ screenshot('app-running')
+ subprocess.run(['taskkill', '/IM', 'Yogurt.exe', '/F', '/T'], capture_output=True)
+ proc.wait(30)
+ time.sleep(2)
+
+
+def click_through(label: str, app_dir: Path | None, models_dir: Path | None, expect_models_page: bool = True) -> None:
+ """Runs the installer with its pages; None keeps a page's default."""
+ consent = ConsentWatch()
+ proc = subprocess.Popen([str(INSTALLER)])
+ win = wait('the installer window', lambda: (ws := setup_windows()) and ws[0], 120)
+ first = wait_page(win, 'Choose Install Location', 60)
+ check(f'{label}: the first page is the install folder (no "for all users" question, which needs an admin)',
+ 'Anyone who uses this computer' not in first and 'Only for me' not in first, first[:200])
+ screenshot(f'{label}-install-folder', win)
+ if app_dir:
+ visible_edit(win).set_edit_text(str(app_dir))
+ time.sleep(0.5)
+ screenshot(f'{label}-install-folder-changed', win)
+ click_next(win)
+ time.sleep(1.5)
+ text = page_text(win)
+ if expect_models_page:
+ text = wait_page(win, 'AI models', 30)
+ check(f'{label}: the models page has its own heading', 'Choose where the AI models go' in text and 'Choose Install Location' not in text, text[:200])
+ field = visible_edit(win)
+ default = field.window_text()
+ check(f'{label}: the models page offers the profile folder by default', default.lower() == str(PROFILE / 'models').lower(), default)
+ screenshot(f'{label}-models-folder', win)
+ if models_dir:
+ field.set_edit_text(str(models_dir))
+ time.sleep(0.5)
+ screenshot(f'{label}-models-folder-changed', win)
+ click_next(win)
+ else:
+ check(f'{label}: no models page when models are already downloaded', 'AI models' not in text, text[:200])
+ # installing, then the last page: Yogurt is not started from it here (the checks start it themselves)
+ wait('the installer to finish', lambda: 'Finish' in page_text(win) or 'Completing' in page_text(win), 600)
+ screenshot(f'{label}-finish', win)
+ for c in win.descendants(class_name='Button'):
+ if c.is_visible() and 'Run' in c.window_text():
+ try: c.uncheck()
+ except Exception: pass
+ click_next(win)
+ proc.wait(60)
+ consent.stop = True
+ check(f'{label}: the installer exits cleanly', proc.returncode == 0, proc.returncode)
+ check(f'{label}: no admin (UAC) prompt came up', not consent.seen)
+
+
+def uninstall(app_dir: Path) -> None:
+ un = next(app_dir.glob('Uninstall*.exe'))
+ subprocess.run([str(un), '/S', f'_?={app_dir}'], timeout=300)
+ shutil.rmtree(app_dir, ignore_errors=True)
+
+
+def main() -> int:
+ data = INSTALLER.read_bytes()
+ level = re.search(rb'requestedExecutionLevel\s+level="(\w+)"', data)
+ check('the installer never asks Windows for an admin (manifest asInvoker)', level and level.group(1) == b'asInvoker', level and level.group(1))
+
+ shutil.rmtree(PROFILE, ignore_errors=True)
+ shutil.rmtree(MODELS, ignore_errors=True)
+
+ # 1. custom folders, clicked through
+ click_through('custom', APP_DIR, MODELS)
+ check('custom: the app is in the chosen install folder', (APP_DIR / 'Yogurt.exe').exists(), APP_DIR)
+ check('custom: nothing in the default install folder', not (DEFAULT_APP_DIR / 'Yogurt.exe').exists())
+ check('custom: models-dir.txt holds the chosen models folder', read_models_txt() == str(MODELS), read_models_txt())
+ check('custom: the models folder was made', MODELS.is_dir())
+ hkcu, hklm = uninstall_entries(winreg.HKEY_CURRENT_USER), uninstall_entries(winreg.HKEY_LOCAL_MACHINE)
+ check('custom: the uninstall entry is under HKCU, pointing at the chosen folder',
+ any(Path(e['location']) == APP_DIR for e in hkcu), hkcu)
+ check('custom: no uninstall entry under HKLM (not installed for all users)', not hklm, hklm)
+
+ # 2. a silent update over it, the way the app installs one (--updated /S)
+ saved = (PROFILE / 'models-dir.txt').read_bytes()
+ (APP_DIR / 'Yogurt.exe').unlink()
+ seen: list[str] = []
+ proc = subprocess.Popen([str(INSTALLER), '--updated', '/S'])
+ while proc.poll() is None:
+ seen += [w.window_text() for w in setup_windows()]
+ time.sleep(0.2)
+ check('update: exits cleanly', proc.returncode == 0, proc.returncode)
+ check('update: shows no pages', not seen, sorted(set(seen)))
+ check('update: models-dir.txt is unchanged', (PROFILE / 'models-dir.txt').read_bytes() == saved)
+ check('update: the app lands in the chosen install folder again', wait('Yogurt.exe back', lambda: (APP_DIR / 'Yogurt.exe').exists(), 60))
+ check('update: still nothing in the default install folder', not (DEFAULT_APP_DIR / 'Yogurt.exe').exists())
+
+ # 3. the installed app looks for its models in the chosen folder
+ found = run_app_and_read_models_dir()
+ check('app: looks for its models in the chosen folder', found and Path(found) == MODELS, found)
+
+ # 4. a fresh install with the defaults
+ uninstall(APP_DIR)
+ shutil.rmtree(PROFILE, ignore_errors=True)
+ click_through('defaults', None, None)
+ check('defaults: the app is in the default install folder', (DEFAULT_APP_DIR / 'Yogurt.exe').exists(), DEFAULT_APP_DIR)
+ check('defaults: no models-dir.txt (the profile folder is used)', read_models_txt() is None, read_models_txt())
+ found = run_app_and_read_models_dir()
+ check('defaults app: looks for its models in the profile', found and Path(found) == PROFILE / 'models', found)
+
+ # 5. models already downloaded: the page is skipped, nothing is written
+ uninstall(DEFAULT_APP_DIR)
+ (PROFILE / 'models' / 'llm').mkdir(parents=True, exist_ok=True)
+ (PROFILE / 'models' / 'llm' / 'model.gguf').write_text('fake')
+ click_through('models-exist', None, None, expect_models_page=False)
+ check('models-exist: no models-dir.txt written', read_models_txt() is None, read_models_txt())
+
+ failed = [n for n, ok in results if not ok]
+ print(f'\n{len(results) - len(failed)} of {len(results)} checks passed')
+ for n in failed: print('FAILED:', n)
+ return 1 if failed else 0
+
+
+if __name__ == '__main__':
+ try:
+ sys.exit(main())
+ except Exception:
+ screenshot('error')
+ raise
diff --git a/app/src/main/index.ts b/app/src/main/index.ts
index ddaccc61..8de81370 100644
--- a/app/src/main/index.ts
+++ b/app/src/main/index.ts
@@ -24,7 +24,7 @@ import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs'
import os from 'node:os'
import { basename, join } from 'node:path'
import { pathToFileURL } from 'node:url'
-import { isFake, userDataDir } from './paths'
+import { isFake, modelsFolder, userDataDir } from './paths'
import { logToFile } from './log'
import { includesRecordingCredit, loadSettings, localeOf, keepsRecording, recordingReminderOn, spokenSetting, stopsWhenCallEnds, updateSettings, visibilityOf, summaryLanguageSetting } from './settings'
import { CALL_GONE_MS, micPids, useCallApps, watchEveryMs, type MicApp } from './detect'
@@ -190,7 +190,9 @@ function createWindow() {
/** Windows and Linux: what graphics the notes engine can use; null when it can't tell (or crashed checking: it then runs without them) */
let probeGpu: () => Promise<GpuProbe | null> = async () => null
function createSetup(): SetupController {
- const modelsDir = join(userDataDir(), 'models')
+ const modelsDir = modelsFolder()
+ // the Windows installer may have put them on another drive: the log says where they are looked for
+ console.info(`MODELS dir=${modelsDir}`)
return new SetupController({
modelsDir,
upgradePreference: {
diff --git a/app/src/main/paths.ts b/app/src/main/paths.ts
index 32c5b714..87af6b56 100644
--- a/app/src/main/paths.ts
+++ b/app/src/main/paths.ts
@@ -1,9 +1,27 @@
// a default import, so plain Node (local recording checks) can load this file too
import electron from 'electron'
-import { join } from 'node:path'
+import { readFileSync } from 'node:fs'
+import { isAbsolute, join } from 'node:path'
/** One profile folder however Yogurt is started (dev, packaged): ~/Library/Application Support/Yogurt. YOGURT_USER_DATA uses a separate one (tests) */
export const userDataDir = (): string => process.env.YOGURT_USER_DATA ?? join(electron.app.getPath('appData'), 'Yogurt')
+/**
+ * Where the downloaded models live (5 to 12 GB): YOGURT_MODELS_DIR, else the folder the Windows installer asked for
+ * (build/installer.nsh writes it to models-dir.txt, UTF-16 with a byte-order mark), else <profile>/models.
+ * Settings, meetings and logs stay in the profile either way.
+ */
+export const modelsFolder = (): string => {
+ const env = process.env.YOGURT_MODELS_DIR
+ if (env && isAbsolute(env)) return env
+ try {
+ const raw = readFileSync(join(userDataDir(), 'models-dir.txt'))
+ const text = raw[0] === 0xff && raw[1] === 0xfe ? raw.subarray(2).toString('utf16le') : raw.toString('utf8')
+ const chosen = text.trim()
+ if (chosen && isAbsolute(chosen)) return chosen
+ } catch { /* no folder chosen */ }
+ return join(userDataDir(), 'models')
+}
+
/** Test mode: stand-ins for everything that needs a model, the microphone or a calendar */
export const isFake = (): boolean => process.env.YOGURT_FAKE === '1'
diff --git a/app/test/modelsFolder.test.ts b/app/test/modelsFolder.test.ts
new file mode 100644
index 00000000..9089c502
--- /dev/null
+++ b/app/test/modelsFolder.test.ts
@@ -0,0 +1,37 @@
+import { mkdtempSync, rmSync, writeFileSync } from 'node:fs'
+import { tmpdir } from 'node:os'
+import { join } from 'node:path'
+import { afterEach, describe, expect, it, vi } from 'vitest'
+
+vi.mock('electron', () => ({ default: { app: { getPath: () => '/nowhere' } } }))
+import { modelsFolder } from '../src/main/paths'
+
+const dirs: string[] = []
+afterEach(() => { dirs.splice(0).forEach((d) => rmSync(d, { recursive: true, force: true })); delete process.env.YOGURT_USER_DATA; delete process.env.YOGURT_MODELS_DIR })
+const profile = () => { const d = mkdtempSync(join(tmpdir(), 'yogurt-models-')); dirs.push(d); process.env.YOGURT_USER_DATA = d; return d }
+
+// Windows: the installer asks where the models go and leaves the answer in models-dir.txt (build/installer.nsh)
+describe('where the models are kept', () => {
+ it('in the profile by default', () => {
+ const d = profile()
+ expect(modelsFolder()).toBe(join(d, 'models'))
+ })
+ it("the folder the installer saved, written by NSIS as UTF-16 with a byte-order mark (any drive, any name)", () => {
+ const d = profile()
+ const chosen = join(d, 'Données IA', 'Yogurt models')
+ writeFileSync(join(d, 'models-dir.txt'), Buffer.concat([Buffer.from([0xff, 0xfe]), Buffer.from(`${chosen}\r\n`, 'utf16le')]))
+ expect(modelsFolder()).toBe(chosen)
+ })
+ it('plain UTF-8 works too, and a relative or empty answer is ignored', () => {
+ const d = profile()
+ writeFileSync(join(d, 'models-dir.txt'), 'relative\\path')
+ expect(modelsFolder()).toBe(join(d, 'models'))
+ writeFileSync(join(d, 'models-dir.txt'), join(d, 'm2'))
+ expect(modelsFolder()).toBe(join(d, 'm2'))
+ })
+ it('YOGURT_MODELS_DIR wins', () => {
+ const d = profile()
+ process.env.YOGURT_MODELS_DIR = join(d, 'env')
+ expect(modelsFolder()).toBe(join(d, 'env'))
+ })
+})
diff --git a/app/test/windowsInstaller.test.ts b/app/test/windowsInstaller.test.ts
new file mode 100644
index 00000000..b26bd5dd
--- /dev/null
+++ b/app/test/windowsInstaller.test.ts
@@ -0,0 +1,32 @@
+import { readFileSync } from 'node:fs'
+import { join } from 'node:path'
+import { describe, expect, it } from 'vitest'
+
+const builder = readFileSync(join(__dirname, '../electron-builder.yml'), 'utf8')
+const nsh = readFileSync(join(__dirname, '../build/installer.nsh'), 'utf8')
+
+// a small C: drive: the installer asks where Yogurt goes and where its AI models go; nothing about it in the app
+describe('Windows installer', () => {
+ it('lets the person pick the install folder, still per user with no admin prompt', () => {
+ expect(builder).toMatch(/oneClick: false/)
+ expect(builder).toMatch(/allowToChangeInstallationDirectory: true/)
+ expect(builder).toMatch(/perMachine: false/)
+ expect(builder).toMatch(/include: build\/installer\.nsh/)
+ })
+ it('never offers "Anyone who uses this computer" (that one needs an admin): always just this person', () => {
+ const body = nsh.match(/!macro customInstallMode\b([\s\S]*?)!macroend/)?.[1] ?? ''
+ expect(body).toMatch(/StrCpy \$isForceCurrentInstall "1"/)
+ })
+ it('asks where the models go after the install folder, never on an update or when models already exist, and saves it where the app reads it', () => {
+ expect(nsh).toContain('!macro customPageAfterChangeDir')
+ expect(nsh).toContain('${If} ${Silent}')
+ expect(nsh).toContain('$APPDATA\\Yogurt\\models\\*.*')
+ expect(nsh).toContain('$APPDATA\\Yogurt\\models-dir.txt')
+ expect(nsh).toContain('FileWriteUTF16LE')
+ })
+ it('the models page has its own heading, not the install folder page\'s', () => {
+ const create = nsh.match(/Function modelsPageCreate([\s\S]*?)FunctionEnd/)?.[1] ?? ''
+ expect(create).toMatch(/GetDlgItem \$\d \$HWNDPARENT 1037[\s\S]*WM_SETTEXT[\s\S]*AI models/)
+ expect(create).toMatch(/GetDlgItem \$\d \$HWNDPARENT 1038[\s\S]*WM_SETTEXT/)
+ })
+})