1

I have a simple app that copies some folders and files in C:/ directory with attribute READ ONLY. I did it well. But my problem is when I try to uninstall the previous version and install the new version, this folder did not remove because attribute is set read only. What i want to do is

1-when user install the app I want inno setup check if the app already installed or not

2-uninstall the previous first and then install the new version.

I must set attribute read only for this folders and files.

[Files]
Source: "D:\POS CAD Standard\acad.lsp"; DestDir: "{userappdata}\Autodesk\AutoCAD 2014\R19.1\enu\support";
Source: "D:\POS CAD Standard\CAD\*"; DestDir: "{sd}\POS CAD Standard"; Flags:recursesubdirs createallsubdirs; Attribs: readonly hidden system;
; NOTE: Don't use "Flags: ignoreversion" on any shared system files
[dirs]
Name:   "{sd}\POS CAD Standard";Attribs: readonly hidden system;
[Icons]
Name: "{group}\{cm:UninstallProgram,ALstom POS CAD Standard}";Filename: "{uninstallexe}"
Martin Prikryl
  • 188,800
  • 56
  • 490
  • 992
Mohamed Ahmed
  • 113
  • 11
  • As [I asked you already](http://stackoverflow.com/q/36308479/850848#comment60395397_36309024): Do you really want to set the folder read-only? Or did you wanted to prevent a regular user from deleting/modifying the files? The read-only flag is a bad measure for that. You better change permissions of the folder. This way you both really prevent regular users from modifying/deleting the files; and make the removing of the folder on uninstall working (as the uninstaller runs with elevated privileges). – Martin Prikryl Apr 04 '16 at 08:34
  • yes the folders must be read-only i have to do that to save my standard.its autocad drawings. – Mohamed Ahmed Apr 04 '16 at 10:24
  • ok martin,how can i make check before install – Mohamed Ahmed Apr 04 '16 at 10:24
  • But wouldn't read-only permissions do the same job as read-only attribute? – Martin Prikryl Apr 04 '16 at 10:49
  • You will also have problems upgrading your installation with read-only attributes (but not with read-only permissions). – Martin Prikryl Apr 04 '16 at 10:55
  • ok martin i will try read only permission and give you feedback – Mohamed Ahmed Apr 04 '16 at 10:58
  • martin i found some thing and it works great for me. flag overwritereadonly. it's work good – Mohamed Ahmed Apr 04 '16 at 11:03
  • now i want to check old version before install the new.sorry martin i really appreciate your effort – Mohamed Ahmed Apr 04 '16 at 11:06
  • You are right that `overwritereadonly` will help with upgrade. But it won't help with uninstall. – Martin Prikryl Apr 04 '16 at 11:22

1 Answers1

2

Use uninsremovereadonly flag.

And as you have found yourself already, use also overwritereadonly flag to allow upgrade.

Source: "D:\POS CAD Standard\CAD\*"; DestDir: "{sd}\POS CAD Standard"; \
    Flags: recursesubdirs createallsubdirs uninsremovereadonly overwritereadonly; \
    Attribs: readonly hidden system;
Martin Prikryl
  • 188,800
  • 56
  • 490
  • 992