0

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!

kefir500
  • 4,184
  • 6
  • 42
  • 48
alecs26
  • 51
  • 6

1 Answers1

0

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

Community
  • 1
  • 1
Pavan Chandaka
  • 11,671
  • 5
  • 26
  • 34
  • Thank you very much for your answer. What I would like is to have all users share the same parameters. My idea was then to place the parameters in C:\ProgramData\Mysoft, which is the generic data location. However, from what I understand, this is a read-only location and the user would not be able do save his parameters there... I guess I don't have the choice and I must select a path in the user's path ? – alecs26 May 19 '17 at 11:57
  • If that's the case, I would have to set the location to C:/Users/alecs26/AppData/Roaming/testPaths. The problem with that is that if I create the .txt parameters files at the software installation, it will be ok for this user but if another users logs in, he won't have any files in his AppData location. I could detect that there are no files and create files with default parameters at this location. Would that be a good idea ? – alecs26 May 19 '17 at 11:59
  • Yes.... if you want to share the information then try writing to remote location where everybody has write access.... – Pavan Chandaka May 19 '17 at 15:00