I have an app written in VB6 with a MDB database.
When installing the latest version if user has an older version than I would like to copy the old DB Folder(Program Files/AppName/DATA/) to the new installation instead of setting up the default DB.
The new version will be installed in a new folder Program Files/AppName2/DATA
if datafolder exists in program files/appName/DATA
copy datafolder to Program Files/AppName2/DATA
Any suggestions ?
Thank you
I'm not sure why you're asking this, as it is similar to your previous question which I have provided a solution for. Just use the DirExists and FileCopy functions.
Source: "{pf}\App\Data\*.*"; DestDir: {code:DataPath}\; Check: DirExists(ExpandConstant('{pf}\App\Data\')); Flags: ignoreversion recursesubdirs external
Related
I have created an installer using Inno 5.5.9 and am installing a number of binary files that need to be marked as shared because a second installer could install a second program to the same directory and these files are common across the two programs.
I am marking the files with the flags 'sharedfile uninsnosharedfileprompt' but they are not removed on uninstall even if they are not in use.
In my testing I install the main program and then uninstall it immediately. The uninstall log says it is 'decrementing shared count' for these files but the shared count is not reaching zero. This is a 32bit program installed onto Windows 10.
#define SourceDirectory "..\bin2017\win32"
#define InstallPath "{app}\bin\Win32\"
[Files]
Source: "{#SourceDirectory}\*.dll"; DestDir: "{#InstallPath}"; Flags: ignoreversion sharedfile uninsnosharedfileprompt
What am I missing to make this work correctly? What could be preventing the uninstaller from decrementing the shared count to zero?
If you need any more info or code please let me know (this is my first question on the excellent site).
Thanks in advance.
The path in the original location has most likely some orphan reference.
I believe your code is correct and the installer behaves correctly. It's just a local problem with reference counting.
I have few SQL script files which have to run before installation begin. The reason is if SQL scripts run successfully only, I want to do the installation.
If the SQL scripts need to run after the installation, I can copy the files to {app} path and run the files from there. But the requirement is run the files before installation begins. I am confused. What is the best way of doing it?
Say for example if it is a single file I can put it under Files section and can use ExtractTemporaryFile('FileName');
But as I mentioned, I have many files (in SQLSCRIPTS folder). What is the better way? (One solution is I can make it as a single file by zipping it and then unzip it)
[Files]
Source: "C:\\SQLSCRIPTS\\*"; DestDir: "{app}"; Flags: dontcopy
To extract multiple files from installer, use the ExtractTemporaryFiles, like:
ExtractTemporaryFiles('*.sql');
I was using Inno Setup QuickStart Pack 5.5.6 and it was perfect.
I installed Inno 5.5.8 QuickStart Pack 5.5.8 and I'm having some problem.
If I start Inno Setup I can select appname, company and Ii can select path of the program and program exe file, so look this screen:
like you can see I selected the main .exe in \Binaries\Win32\ so it is located not in main folder of the program but in a sub-folder.
Now this is the code that I have
Inno Script studio automatically write the wrong exe path, it is not the main folder of the program but like I said already it is in \Binaries\Win32\.
But why it did this? I worked with Inno Setup QuickStart pack 5.5.6 and I never seen this problem, the correct path was correct also if the exe was in some sub-folder.
You have these two entries in the [Files] section.
[Files]
Source: "C:\temp\Life Is Strange Episode 5\Binaries\Win32\LifeIsStrange.exe"; \
DestDir: "{app}"; Flags: ignoreversion
Source: "C:\temp\Life Is Strange Episode 5\*"; \
DestDir: "{app}"; Flags: ignoreversion recursesudirs createallsubdirs
This does not make any sense. The entries overlap.
It seems you believe that by selecting the directory C:\temp\Life Is Strange Episode 5 in the "Other application files" setting you somehow miraculously define a mapping between the C:\temp\Life Is Strange Episode 5 and the {app} that should make Inno Setup Studio know that when you select the main application file C:\temp\Life Is Strange Episode 5\Binaries\Win32\LifeIsStrange.exe it should go to {app}\Binaries\Win32. It won't. The entries are not related to each other in any way.
So, the first entry will install the LifeIsStrange.exe directly to {app}.
The second entry will install a whole directory tree, including the LifeIsStrange.exe.
So you end up with LifeIsStrange.exe both in the {app} and the {app}\Binaries\Win32.
But the icon will point to {app}\LifeIsStrange.exe.
I believe the Inno Setup Studio does what you asked it to do.
If you want it to do something else, you have to set up things differently. Though I'm not sure the Inno Setup Studio allows you to install the main application executable anywhere else, but to the {app}.
To do what you ask for, you probably have to edit the .iss manually to be like:
[Files]
Source: "C:\temp\Life Is Strange Episode 5\*"; DestDir: "{app}"; \
Flags: ignoreversion recursesudirs createallsubdirs
[Icons]
Name: "{group}\{#MyAppName}"; FileName: "{app}\Binaries\Win32\LifeIsStrange.exe"
I've created a setup file for my application, which works fine for new installations, but I now need to adapt it to handle upgrades.
I understand I should add DisableDirPage=auto under [Setup], so the user won't be prompted for an installation folder during upgrades?
I also do a few things in [Run]. How do I skip these actions when it's an upgrade?
Under [Files] I currently use a single line to install everything to the application folder:-
Source: "{#BuildOutputFolder}\*"; DestDir: "{app}"; Flags: onlyifdoesntexist recursesubdirs createallsubdirs
Firstly, I'm guessing this won't work during an upgrade as "onlyifdoesntexist" would prevent the EXE and DLLs from ever being overwritten, even with newer versions?
Secondly, there are certain files (e.g. configs) that get installed, but should never be overwritten during an upgrade. I'm guessing the current line isn't sufficient and I would need to replace it with a number of separate lines to achieve this functionality, e.g. one to install the EXE, one for the DLLs, and one for the configs (with "onlyifdoesntexist")?
I have an embedded 7Zip archive in my setup script.
Is there a "native" way of extracting the contents to a target folder?
If not any hints on how this could be achieved?
Updated with my implementation. Thanks for the hint TLama
[Files]
Source: "Documentation.7zip"; DestDir: "{tmp}"
Source: "7za.exe"; DestDir: "{tmp}"
[Run]
Filename: "{tmp}\7za.exe"; Parameters: "x -o""{app}"" ""{tmp}\Documentation.7zip"""; Flags: runhidden; Description: "{cm:InstallingDocumentation}"; StatusMsg: "{cm:InstallingDocumentationStatus}"
[CustomMessages]
en.InstallingDocumentation=Documentation Files
en.InstallingDocumentationStatus=Installing Documentation Files. This may take several minutes...
No, there is no native way to extract 7zip files from InnoSetup installer. However, you can get a copy of 7zip library, which is redistributable and call it from InnoSetup script's code section.
Inno doesn't have any native method of extracting files from anything other than it's own archives (which normally compress better than 7Zip).
Inno Setup can however use wildcards for including files to install:
[Files]
Source: "Documentation\*.*"; DestDir: "{app}/Documentation/";
If you have many small files, using the solidcompression flag will improve compression performance and size.