feat: add portable mode to NSIS installer#807
Conversation
Custom NSIS template based on tauri-v2.9.1 upstream with 6 targeted modifications for portable mode support: - New PortableMode variable and /PORTABLE CLI flag for silent installs - Install type selection page with Normal/Portable radio buttons - Conditional default directory (Desktop for portable, LocalAppData for normal) - Skip registry writes, file associations, deep links, and uninstaller for portable - Skip Start Menu and desktop shortcuts for portable installs - Create portable marker file and Data/ directory on portable install The existing portable.rs runtime detection is unchanged — it looks for the same marker file this installer creates. Usage: GUI: select "Portable Installation" on the install type page Silent: Handy_setup.exe /S /PORTABLE /D=C:\path\to\Handy Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Detect a `portable` marker file next to the executable at startup. When present, redirect all data paths (settings, models, recordings, database, logs) to a local `Data/` directory instead of %APPDATA%. This approach works because it intercepts path resolution at the Rust level, bypassing Tauri/Windows Shell API limitations that made the previous environment-variable and junction approaches unreliable. Changes: - Add src-tauri/src/portable.rs with OnceLock-based detection - Replace all app.path().app_data_dir() calls with portable helper - Configure tauri-plugin-log to use Folder target when portable - Configure tauri-plugin-store with absolute path when portable - Simplify build.yml portable ZIP (exe + resources + marker file) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The .path() method on AppHandle requires `tauri::Manager` in scope. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Move main window creation from tauri.conf.json to setup closure so we can set data_directory when in portable mode. This prevents WebView2 from creating %LOCALAPPDATA%\com.pais.handy. Also set data_directory on the recording overlay window. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
When the Tauri updater runs the installer with /UPDATE, the install type page is skipped and /PORTABLE is not passed. Detect the existing portable marker file in .onInit so updates preserve portable mode automatically. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
Hello @back1ply Just one thing — on my Windows 11, after the initial pop-up window for selecting and downloading the model appears and once the download has finished, it hangs for a moment. I assume this is because the application is performing some process maybe decompression? |
|
It's also working for me, great job ! |
|
Thanks for this, this looks much more reasonable for portability. Also great to have other users confirmation, I will see about merging this soon |
🧪 Test Build ReadyBuild artifacts for PR #807 are available for testing. Download artifacts from workflow run Artifacts expire after 30 days. |
Hi @cjpais There should be an option of "Portable Installation" in the NSIS executable binary, But it seems to be missing from the latest |
|
This PR is not merged. Try the test build in this thread. 0.7.6 does not have portable functionality. I need confirmation that BOTH portable and regular installations from the test build work as expected on Windows. |
|
I see, thank you very much! |
|
@jsntn @JoeBarouneD @back1ply can you try the build here and let me know if it works in both portable and regular installation modes |
|
Notes for the NSIS for now: I expect for the install mode and update path to be I am not sure yet how we can do the NSIS portable update but as a compromise for if we detect a portable install the update button will show a pop up asking user to manally download the nsis from github and copy his old files (recordings, settings and models) from old vers. to new one. Also in portable mode, the "Create Desktop Shortcut" seems to be not working. |
Hi @cjpais |

Before Submitting This PR
Please confirm you have done the following:
If this is a feature or change that was previously closed/rejected:
Human Written Description
Welp, lets hope 2nd time a charm :)
Anyway, a test nsis (exe) file is available, any volunteers with a windows machine are welcome to test.
https://github.com/back1ply/Handy/actions/runs/21954326041/artifacts/5485647980
The Portable option in the setup

Related Issues/Discussions
Fixes #153
Supersedes the reverted #753 with a fundamentally different approach.
See also: #567, #785
Previous approach (#753) added a ZIP-based portable distribution but was reverted because:
%APPDATA%— not truly portable (as noted by @jsntn and @JoeBarouneD in feat: add portable ZIP archives for Windows releases #753 comments)Community Feedback
This PR addresses both concerns directly.
What Changed
Approach: Custom NSIS Template + Runtime Path Redirection
Instead of a separate ZIP distribution, this adds a portable mode option directly in the existing NSIS installer (like Notepad++ does). Users pick "Normal" or "Portable" during install.
Two components:
Custom NSIS template (
src-tauri/nsis/installer.nsi) — Based on upstreamtauri-v2.9.1template with 6 targeted modifications:/PORTABLECLI flag for silent installsDesktop\Handyfor portable)portablemarker file +Data/directoryRuntime path redirection (
src-tauri/src/portable.rs) — On startup, detects theportablemarker file and redirects ALL data paths (settings, models, recordings, logs, WebView2 cache) toData/next to the exe. Nothing touches%APPDATA%or%LOCALAPPDATA%.Files Changed
src-tauri/nsis/installer.nsisrc-tauri/tauri.conf.jsonnsis.templatepathsrc-tauri/src/portable.rssrc-tauri/src/lib.rsportable::init()at startup, use portable-aware pathssrc-tauri/src/settings.rssrc-tauri/Cargo.tomldirscrate for fallback data dir resolutionUsage
GUI install:
Run installer → select "Portable Installation" → choose directory → done
Silent install:
Updates: The updater automatically detects the
portablemarker file — no special flags needed.Maintenance Note
The custom NSIS template must be manually synced when upgrading Tauri. Portable changes are isolated and marked with
; --- PORTABLE MODE ---comments to make merging straightforward. A version comment header notes the base version (tauri-v2.9.1).Testing
Tested on Windows 10 Pro (x64):
portablemarker +Data/directory createdHandy_setup.exe /S /PORTABLE /D=C:\pathworksData/— no%APPDATA%\com.pais.handyor%LOCALAPPDATA%\com.pais.handycreatedwindows-latestwith NSIS bundlingScreenshots/Videos (if applicable)
AI Assistance
If AI was used: