Installation path in ProgramFiles : some concerns

376 Views Asked by At

I am developing a software for Windows (XP to 10 and beyond) with Qt 5 C++. As of now, the default installation path is in C:\Users\Public\Kontiki. However, I read that it might not be a good practice and that I should rather install it in C:\ProgramFiles\Kontiki. That's what I plan to do.

However, I have two main concerns.

Concern 1

The files in my installation folder includes the .exe, .dll and documentation. However, it also includes users parameters (.txt files). The user must be able to change these parameters with the help of a GUI in my program. The problem is that when my software is in ProgramFiles, this can't be done since they don't have the rights to write in ProgramFiles. What I should do is place the .txt parameters files in AppData. So what I would do is:

  1. At the installation (with NSIS installer), I would write the .txt parameters files to $APPDATA
  2. In my Qt program, I would access these .txt parameters with QStandardPaths::AppDataLocation All this to say that my concern is that I am not sure that the path from the NSIS installer $APPDATA will always be the same that the one returned by Qt with QStandardPaths::AppDataLocation. For instance, maybe on a new version of Windows there will be some differences or something. Maybe it's not a legit concern but I wanted to verify.

Concern 2

If the program is installed in ProgramFiles, is it possible that I would have some problems with UAC (for instance if the user is not admin) or anything?

Thank you so much for your help!

1

There are 1 best solutions below

3
On

If the program is installed in ProgramFiles, the user can execute the program with out any problem (irrespective of admin status).

But if the application has to update any files (.txt files in your case), any directory that is in user account is a good place. Most of the applications use Documents folder for such scenarios.

And moreover ProgramFiles directory is not specific to user.

May be good approach is to create an user environment variable for the directory you want to place the files you want to update (easy to modify for any unexpected situations). Read the environment variable in NSIS file and application programmatically and use it.

environment variable ex:

PROJECTDIR -- C:\Users((USERID))\Documents\projectDir