22

My kit created with Inno Setup installs my application in C:\Program Files\MyApp.

When my application starts, it tries to create new log files in C:\Program Files\MyApp\logs\ but it fails.

In my Inno script i have the following settings:

[Dirs]
Name: "{app}";

[Files]
Source: logs\*; DestDir: {app}\logs\; Flags: ignoreversion recursesubdirs createallsubdirs; Permissions: everyone-full

This gives full permissions on all files inside logs folder, but not on the folder itself. So, when my application tries to create a new log file inside that folder, it fails.

How can i set full permissions on the folder as well, not only on the existing files in it?

Cornelia
  • 618
  • 1
  • 4
  • 11
  • 1
    The [`same as here`](http://stackoverflow.com/questions/17580222/creating-folder-for-log-files-for-nlog-with-innosetup#comment25581266_17580222) applies for you. – TLama Jul 11 '13 at 14:30
  • 1
    @TLama thanks for the link, i will try it and come back with the results – Cornelia Jul 11 '13 at 14:47
  • 1
    Whenever possible, avoid using full permissions and use modify instead. – amalgamate Jan 20 '16 at 17:51

2 Answers2

24

Setting permissions for logs folder under [Dirs] section worked for me:

[Dirs]
Name: "{app}"; 
Name: "{app}\logs"; Permissions: everyone-full

[Files]
Source: logs\*; DestDir: {app}\logs\; Flags: ignoreversion recursesubdirs createallsubdirs; Permissions: everyone-full

But, as in this post, i'm not sure if it's the proper way to do it.

Community
  • 1
  • 1
Cornelia
  • 618
  • 1
  • 4
  • 11
  • 3
    everyone-full is maybe too much, from the doc it looks like users-modify is enough. http://www.jrsoftware.org/ishelp/index.php?topic=dirssection http://www.jrsoftware.org/ishelp/index.php?topic=filessection – Joël Apr 12 '17 at 12:30
  • 1
    @Joël Cool. Thanks for mentioning modify permission and the documentation. – Naveen Kumar V Oct 25 '21 at 17:54
13

Simply using the following code works for me and I think it is more secured:

[Dirs]
Name: "{app}\logs"; Permissions: users-full
Amirhossein Mehrvarzi
  • 18,024
  • 7
  • 45
  • 70
Jean
  • 131
  • 1
  • 2
  • 1
    You're right about "users" instead of "everyone". Still, as the linked posts have said, "full" is probably unnecessary. In fact, my app only worked once I set the permissions to "modify", because the system wouldn't let me set permissions to "full". – Matthew Milone Jan 07 '20 at 15:38
  • Your solution was the simplest and worked just fine for me! – DrupalFever May 05 '20 at 23:17