Inno Setup - How to set permissions of installation folder

孤者浪人 提交于 2019-12-30 07:09:11

问题


I am using Inno Setup to create an installer of my application.

On the first run my application is creating an SQLite database but it can't achieve that while the user doesn't have the permission of modify the installation folder.

I managed to set permissions of files:

[Files]
Source: "D:\....\***.jar"; DestDir: "{app}"; Flags: ignoreversion; Permissions: users-full
Source: "D:\....\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs;\
    Permissions: users-full

But that doesn't help because I need full users permission on installation folder, for example: C:\Program Files\InstallationFolder


回答1:


The Permissions parameter of the [Files] section entry applies to the installed files only, not to the implicitly created directories.

To change permissions of a folder, use an explicit entry in the [Dirs] section for the {app}:

[Dirs]
Name: {app}; Permissions: users-full

Though it is not a good practice.

  • In general, Windows applications shall not require write permissions to their folder. That's against Windows guidelines. The application should write data to a user profile folder (C:\Users\username\AppData) or to a common data folder (C:\ProgramData).

    See also Application does not work when installed with Inno Setup.

  • In your specific case, you better run the database creation process as the Administrator (e.g. using the runascurrentuser flag).


来源:https://stackoverflow.com/questions/34717752/inno-setup-how-to-set-permissions-of-installation-folder

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!