OpenVPN / openvpn-gui

OpenVPN GUI is a graphical frontend for OpenVPN running on Windows 7 / 8 / 10. It creates an icon in the notification area from which you can control OpenVPN to start/stop your VPN tunnels, view the log and do other useful things.
Other
1.38k stars 397 forks source link

Move application data to %APPDATA% #690

Closed JackTrapper closed 1 month ago

JackTrapper commented 1 month ago

Currently the OpenVPN application settings end up in:

On Windows (since 1995) this has not been the appropriate folder for these files. This is application data:

And it should be placed in:

If you feel these files should roam with the user, as they logon to different workstations in the enterprise, that their VPN settings should roam with them, you can put these files in their "roaming" AppData folder (rather than the LocalAppData folder):

Placing these files in the user's profile folder (i.e. their home directory) is not appropriate. Windows has defined the place where APPDATA should go.

From the Designed for Microsoft Windows Application Specification, there is a section specifically dedicated to how to decide where to place files:

3.2 Classify and store application data correctly

Applications typically work with two fundamental types of documents: those that are created by the user, and those that are created for use by the application itself. For user-created data, please refer to the guidelines in section 3.1. Section 3.2 applies directly to the data that is created by an application to store user-specific information. This data is used by the application only, and is never intended to be accessed directly by the user.

By storing this application-specific data in one of the several valid locations as described by this specification, you make it possible for multiple people to use the same computer without corrupting or improperly modifying each other’s data. The specification provides several valid locations and you are free to choose the location that works best for your needs.

A clear benefit to the developer is that compliance with this requirement can actually result in fewer lines of code. There is a single API call, SHGetFolderPath, that enables you to determine the correct location in which to store the user’s data and the user-specific application data.

Classifying and storing application data according to the guidelines in this requirement provides these benefits:

• It enables multiple family members to share a computer and helps enable Fast User Switching. • It enables business-related operations such as roaming, off-line storage, and allowing the operating system and its applications to be secured. • It ensures a consistent and abstracted location for user data, enforces per-user separation of application data. • It is one of the key factors in enabling remote use of the application.

Application data includes user preferences, application state, temp files, and so on.

IMPORTANT: For files that the user can open (such as documents, music, pictures, and so on), use the guidelines in section 3.1.

This section identifies the valid file folders and the valid registry locations that applications must use for this data, and gives guidance on how to choose which of these locations are best used in different circumstances. The choice of valid locations to use is left to the software developer.

Classify application data into the following categories:

• Per user, roaming • Per user, non-roaming • Per computer (non-user specific and non-roaming)

NOTE: There may be more than one category for the different application data stored by your application.

For applications not intended to be used in a domain environment (most games and home products for example), classifying the application data as per user, non-roaming might be an appropriate choice.

It is best to use application data file folders rather than the registry for storing application data in excess of 64K. The registry is an acceptable choice for small amounts of data. At installation time, try to store less than a total of 128K across HKEY_CURRENT_USER (HKCU) and HKEY_LOCAL_MACHINE (HKLM).

To comply with this specification, store application data files appropriately as either common or per-user. That is:

• In a subfolder of either the common application folder (identified by CSIDL_COMMON_APPDATA), or • In the user profile folders: application data (CSIDL_APPDATA) or local application data (CSIDL_LOCAL_APPDATA).

The subfolder to create to store user data files in is:

[company name][product name][version].

tl;dr: Only users should be placing folders in their profile folder. Their home directory. Not yours.

selvanair commented 1 month ago

Same as #179.