Skip to content

Commit dc2ce39

Browse files
committed
page about preserving settings
1 parent 0181d75 commit dc2ce39

File tree

2 files changed

+28
-1
lines changed

2 files changed

+28
-1
lines changed

docs/integrating/overview.mdx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,8 @@ It is recommended that you use one of the functions which explicitly applies a p
9898
:::
9999

100100
## How updates work
101+
102+
### On Windows
101103
In a typical Windows install the application structure will look like this:
102104
```
103105
%LocalAppData%
@@ -111,4 +113,10 @@ In a typical Windows install the application structure will look like this:
111113

112114
`sq.version` is a special file created by Velopack which contains some metadata about your currently installed application. During install/uninstall, the entire `{packId}` folder is replaced or removed. During updates, only the `current` folder is replaced. If you store settings in the same folder as your main binary, they will be erased during updates.
113115

114-
If you want to create files that persist through updates, but are erased when the app is uninstalled, you should store them one level up (`..`) outside of the `current` dir. If you want to create files which persist even if the app is uninstalled (eg. important user settings) then you should store them in `%AppData%\{packId}` (that's the roaming app data, not local app data).
116+
:::warning
117+
Since `current` is replaced with the new version during updates, it's not safe to store settings, logs, etc in the `current` dir where your app lives. See ***[Preserving Files](./preserved-files.mdx)*** for more info.
118+
:::
119+
120+
### On Linux & Mac
121+
On these platforms, the app is stored as a single (typically read-only) bundle like `.app` or `.AppImage`. The bundle is replaced during updates in a single atomic operation.
122+
If you have any files you wish to persist (settings, logs, etc) you must find a directory elsewhere on the filesystem to store these files.

docs/integrating/preserved-files.mdx

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Preserving Files & Settings
2+
<AppliesTo all />
3+
Your application binary files get completely replaced during updates, so you should not store important files in the same directory as your application binary files.
4+
5+
## Application Settings
6+
7+
If you want to create settings that persist through updates, but are erased when the app is uninstalled, on Windows you should store them one level up (`..\`) outside of the `current` dir.
8+
9+
If you want to create files which persist even if the app is uninstalled (eg. important user settings) then you should store them in `%AppData%\{packId}` (that's the ***roaming app data***, not local app data where the app lives).
10+
11+
## Sentry / Crashpad / Error Reporting
12+
Many error crash handling utilities will store error/crash reports to the application directory by default, and will upload them as a report the next time the application starts.
13+
14+
You need to ensure any of these libraries can be configured with a database / storage directory outside of the current application directory somewhere.
15+
On Windows, you just need to be outside the `%LocalAppData\{packId}\current` directory. So you could use `..\` (this is the same as `%LocalAppData\{packId}`).
16+
17+
## Non-Windows
18+
For other non-Windows operating systems, you should search online to find best practices about where to store settings/log files for installed apps.
19+
The recommended location is OS / distro specific, and might be in `/var` or somewhere in user home `~` (eg. `~/Library/Application Support` on MacOS).

0 commit comments

Comments
 (0)