SerGreen / Appacker

Tool for making single .exe application packages
234 stars 29 forks source link

Move Registry Settings to INI File, Remember Settings (Hide Launch Popup, Window Position+Size, etc.) #14

Closed hairycactus closed 3 years ago

hairycactus commented 3 years ago

Regarding the new Visual C++ Runtime 2005 x86 not found! reminder popup that appears upon every launch, is it possible to have a tick option Do not show again for the popup, & remember this setting ? (User can still click on the red exclamation mark icon to manually show the popup on-demand.)

Mockup Screenshot:

Appacker Launch Nagscreen

Appacker already writes a non-user-configured setting in the registry at:

HKCU\Software\SerGreen\Appacker  
=> Language = en-US 

How about moving all settings to an INI file within Appacker's folder, so that it doesn't write to the registry or elsewhere in the filesystem ?

Other settings good to have include:

  1. Remembering window position & size
    Currently, Appacker's main window position changes randomly upon every launch.

  2. Options in the Advanced Options section
    Currently, Appacker does not seem to remember any non-default option here.

Tested: Appacker v1.3.9 (23 Oct 2021)
OS: Win 10 x64

Thanks !

SerGreen commented 3 years ago

The first half is no longer an issue now that the popup message is gone in v1.3.10.

As for saving other options between launches: i really like the idea. However, there's a problem with saving options to an INI file: i like to have Appacker as a single file, but Appacker itself doesn't work the way packed apps do, it doesn't repack itself from a temp folder, so it won't be able to extract INI file, modify it and repack it back. It could use an external INI file, but that would mean it's no longer a single file application.

Saving settings in the registry is an option but that would mean that settings aren't portable on a USB stick, for example.

I guess one other option would be to make it SUPPORT external INI file with settings if one is present next to Appacker but it wouldn't create such file if it's missing. Then one could create such INI file manually and use Appacker to pack itself together with this INI file and then it would become a portable single file app with settings in a file. If that makes any sense. I'll try to implement this and see if it works.

hairycactus commented 3 years ago

Do you mean ... ?

  1. Create INI file with text editor.
  2. Use Appacker to pack Appacker together with the INI file created in (1).
    To change settings, redo steps (1) & (2) to create new Appacker.exe.

Maybe I'm misunderstanding what you wrote, but this is very strange workflow just to save some program settings. The Spiderman vs Spiderman meme comes to mind. :)

What I'm talking about is the following. Is it not possible ?

Appacker's Folder Contents:
\Appacker.exe
\Config.ini (or similar filename)

When user runs Appacker & changes some options in the GUI, Appacker saves the new configuration to the INI file.

For portability, the Config.ini file is kept beside Appacker.exe.

For instance, if one selects Advanced Options > Unpack Directory > Ask at every launch, this setting is currently not saved. Neither are any other user-set options being saved. Everything is reset to default at the next launch of Appacker.

That's why I suggested saving (extra) settings (including hiding the now-defunct MS Visual C++ popup), & moving these to an INI file in the EXE's folder for portability.

Otherwise, I would prefer that Appacker NOT save any settings, instead of writing an inconsequential Language setting to: HKCU\Software\SerGreen\Appacker. (I always delete this key after exiting Appacker.)

SerGreen commented 3 years ago

Do you mean ... ?

  1. Create INI file with text editor.
  2. Use Appacker to pack Appacker together with the INI file created in (1). To change settings, redo steps (1) & (2) to create new Appacker.exe.

Only initial setup would require manual intervention, changing settings should be automatical once ini file is created. I think i'll add a button that will generate ini file with settings (so no text editor required), but i don't want this file to be created automatically with the start of the app.

Appacker's Folder Contents: \Appacker.exe \Config.ini

I don't like the idea of having multiple files next to Appacker.exe, i want it to be a single-file-application itself, at least by default. That's why i'm going to make it look for Appacker.ini file in the same folder, but not create it unless user clicks a button "Generate settings file". Once this file is generated, Appacker will load settings from it, but it will also be able to work without this ini file.

I always delete this key after exiting Appacker

Why delete it? Is there anything wrong with storing application configuration in registry?

SerGreen commented 3 years ago

I updated the v1.3.10 release, it should work with ini file now.

It will not create ini file automatically, but you can create it from Advanced Options with a button press. Without the ini file the application will work the same way as before, however, as long as the ini file is present next to Appacker.exe, it will save language, advanced options and window size and position there (automatically). It also won't write to the registry as long as ini file is present.

EDIT: Download the default Appacker.ini file from release as well or it will save language in the registry at the start, before you will be able to generate your own ini file.

SerGreen commented 3 years ago

Issue solved with v1.3.10.

hairycactus commented 2 years ago

Download the default Appacker.ini file from release as well or it will save language in the registry at the start, before you will be able to generate your own ini file.

Just tested the final v1.3.10 release. Appacker now retains its settings via the new INI file. Thanks !

That being said, from my experience of using hundreds of portable programs, it's rather unusual to have to download a default INI separately.

If not already (usually) supplied with the release package, the alternative is for the user to create an empty INI file using a text editor, place it beside the executable file in the same folder, launch the program, & let the program write what needs to be written to the said INI file w/o it ever touching the registry &/or outside of its working folder.

I'm not sure if Appacker behaves like a typical portable program -- so far, the workflow has been rather atypical. So below are some queries ...

  1. If Appacker introduces new settings in a future release (eg. a hypothetical Do not warn on output file overwrite), can we launch the program with the existing INI file, such that all new settings subsequently configured would automatically be written to the INI file ? Or do we need to download a new default INI file (with the fields for the new settings) & redo all the previous settings ?

  2. Would the default INI file be supplied & & its usage instructions spelt out with every new release ? (I assume new users generally look at the latest release, & don't check the older ones for extra required files.)

Why delete it? Is there anything wrong with storing application configuration in registry?

Hope the above explains ...

SerGreen commented 2 years ago

Okay, i understand the reason behind not wanting registry entries. I think i just never designed the app to be portable, the only criteria was to make it a single file application but also be able to remember settings, hence why i didn't want to use an additional config file. I guess i'll make registry saves an opt-in feature in the future release (if there will be one).

As for the questions:

  1. You don't have to download the INI file separately, you can click a button in the options and the app will generate INI file itself. Creating an empty appacker.ini file and placing it in the same folder is also an option. If any file named appacker.ini is present in the same folder as appacker.exe then it will not write to the registry.
  2. Future releases should be able to work with old INI files. It's designed to be able to digest broken files too (it uses default values when it can't find some option in the INI file). You won't have to download new INI files, the app generates and saves a valid INI file when you close the app (only if appacker.ini file already existed before you launched the app).
  3. No, i don't plan to supply default INI files with future releases, user can generate this file manually by clicking a button in Advanced Options. And future releases won't try to use registry anyways, unless user will choose so.