Squirrel.windows: App.Settings and User Settings

Created on 9 Jan 2017  Â·  14Comments  Â·  Source: Squirrel/Squirrel.Windows

Hi Squirrel Team,
How do people usually deal with Squirrel apps that that save data to AppSettings or user settings? I'm finding that as soon as my squirrel app updates, the settings disappear. It is literally like working from a fresh install of the app.

Most helpful comment

I save my config settings outside the app folder, while still inside the %LocalAppData% folder for my program:

image

All 14 comments

I save my config settings outside the app folder, while still inside the %LocalAppData% folder for my program:

image

Can you post the code you use to do that? What about for User settings?

On Mon, Jan 9, 2017 at 2:38 PM, Shannon Skinner notifications@github.com
wrote:

I save my config settings outside the app folder, while still inside the
%LocalAppData% folder for my program:

[image: image]
https://cloud.githubusercontent.com/assets/2253814/21782424/47892b90-d718-11e6-81c1-91dd36db920b.png

—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/Squirrel/Squirrel.Windows/issues/921#issuecomment-271400598,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AM-qVst8-LkAKtXACL0kpYwgcoBukRhkks5rQprFgaJpZM4LeXCi
.

--
Tony Valenti

I'm not sure it will be of much value to you, but here.

I'm just storing bits of JSON that I care about, and this method isn't idiomatic, just something I came up with. You can store user/app settings anywhere/how you want, as long as it's outside your app folder (as you've discovered).

I use Lager, it works well for me, its backed by Akavache.

@stajs I've implemented your approach.
I see a strange behavior: if I try to run setup of the same version for the second time application folder is removed along with config folder.

@stajs did you experience this issue ? if so, how did you solve it?

No, I haven't experienced that issue, although I seem to recall a discussion about this behavior; I believe that is expected. Running the same installer a second time might torch the current install first, so I can see that it would also remove your config folder if it's a child of the application folder.

I haven't done anything for it. You could save your config somewhere else if you wanted, e.g. Registry.

My preference would be to keep all files related to the application in one folder.
In this case we can have simple documentation and it will be easier to support the app.

I've found in the code

this.Log().Info("About to install to: " + mgr.RootAppDirectory);
if (Directory.Exists(mgr.RootAppDirectory)) {
    this.Log().Warn("Install path {0} already exists, burning it to the ground", mgr.RootAppDirectory);

Besides configuration my application needs to save logs somewhere and I'd prefer to keep logs in RootAppDirectory\Logs.

It would be great if we could specify a list of exceptions and exclude some folders/files from deletion (logs, config).

I can see that being of use too, but it could complicate some upgrade scenarios (say, a file format had changed between versions).

BTW, the discussion about what to do when running the same installer (i.e. re-pave) was in #317.

You can try to let application handle user settings upgrade by calling ApplicationSettingsBase method Upgrade:
http://stackoverflow.com/questions/534261/how-do-you-keep-user-config-settings-across-different-assembly-versions-in-net/534335#534335

@skaryshev I think squirrel doesn't work with Settings.Upgrade, I've tried it without success. This behavior has been reported here

Using standard user.config classes you can apply the method described there.
Basically it copies user.config from the older app version folder to the newer app version folder through the app parent folder.

@shiftkey duplicate of #198. I think fixing this (i.e. conflict with how .NET application settings work) is outside of the scope of Squirrel. I'll add docs for workarounds then we can close #198 too.

Duplicate of #198

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Mzartek picture Mzartek  Â·  4Comments

mihaimyh picture mihaimyh  Â·  4Comments

JonZso picture JonZso  Â·  5Comments

CodeFunta picture CodeFunta  Â·  6Comments

joshiji picture joshiji  Â·  6Comments