Create small setup installer just for wizard, rest of files apart - installation

i want to create my own installer for portable apps, games, etc.
Want to create an instalable app from a portable one... yes.
InnoSetup creates a unique EXE file with all app files inside it and i dont want to do that, it is so big and slow to create.
I just want to do an installable app like commercial games or apps, a little setup exe file with the installation wizard, and the all other files of the app/game located in the same directory to be copied to desired destination directory...
thks in advance,
Ima

To refer to the files in the installer's folder, use {src} constant and external flag.
To exclude the installer itself, use Check function to compare CurrentFileName to {srcexe} constant.
[Files]
Source: {src}\*; DestDir: {app}; Check: ExcludeSelf; Flags: external recursesubdirs
[Code]
function ExcludeSelf: Boolean;
begin
Result := (CompareText(CurrentFileName, ExpandConstant('{srcexe}')) <> 0);
end;

Related

Install application dependencies/DLLs using Inno Setup

I have compiled one application, and I have to deploy it. So, I have the application executable and some dynamic libraries. Some from Qt and others.
I need to create an installer which installs my application and its dependencies.
Of course, I was "googleing" but I am not clear at all how to do it. I will be grateful, if someone could to tell me how to do it.
I am working with Windows 10 64bits. I would like to place that dependencies inside of one folder inside of the application folder.
Thanks in advance.
Assuming the DLLs do not need any kind of registration, just deploy them to the target machine to the same directory structure as you have on your development machine.
A trivial example:
[Files]
Source: "C:\MyProject\release\MyProg.exe"; DestDir: "{app}"
Source: "C:\MyProject\release\Qt\*.dll"; DestDir: "{app}\Qt"

How Can I Package a Unity3D 5 Windows Application into a single exe file?

I am new to Unity3d development. I have created two versions of a 3D puzzle app, one for Mac and the other for Windows. Mac applications are created with the package contents contained within it. The Windows application is created with the exe file and a separate data folder with the same name as the exe file + suffix _Data. I want to create a single exe file to distribute on Amazon and other downloadable platforms. The problem I'm having is finding something where the data folder and the exe file have to be located at the same level.
I'm used to Apple devices but recently purchased a Windows laptop for testing.
I could not find anything in the Unity3D documentation on how to do this. The documentation talks about how to distribute the application to the Windows Store, something I don't plan to do. The only thing I could find on their forum was one question that was asked in 2011.
One of the suggested solutions, Enigma Virtual Box, I could not get to work because Unity3D requires that the exe file and the data folder be at the same level. I have also tried the trial for Smart Packer Pro but I need a dll file as a starting point which I could not find in my Unity3D project folder.
All of the information I'm finding related to Windows packaging into a single exe file are at least five years old. None of them relate to packaging Unity3D applications. I have also searched microsoft.com and windows.com but could not find anything there.
UPDATE 5/12/2016 14:15
I installed Inno Setup and attempted to create a script for my application. It copied the exe file but created an empty data folder instead of copying the data folder I need to run the exe file. I checked to make sure that the folder name was correct in the script.
; -- myapplication.iss --
; Demonstrates copying 3 files and creating an icon.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING .ISS SCRIPT FILES!
[Setup]
AppName=myapplication
AppVersion=1.0
DefaultDirName={pf}\myapplication
DefaultGroupName=myapplication
UninstallDisplayIcon={app}\myapplication.exe
Compression=lzma2
SolidCompression=yes
OutputDir=userdocs:Inno Setup Examples Output
[Files]
Source: "myapplication.exe"; DestDir: "{app}"
[Dirs]
Name: "{app}\myapplication_Data";
Packing a Unity3D application is not not possible without 3rd party software.
a bit more recent url (2014) suggests using smart packer, this however is a tool I personally never used before.
I tend to use inno setup as it seems a bit more professional, it eases up moving files, creating links (short-cuts) and uninstalling quite a bit as well. Simply said, this allows you to extract the exe and _data folder to the same folder, and create a shortcut to the exe.
Follow up on edit
I installed Inno Setup and attempted to create a script for my application. It copied the exe file but created an empty data folder instead of copying the data folder I need to run the exe file. I checked to make sure that the folder name was correct in the script.
After selecting the main exe file during the application files part of the setup wizard, you can add a folder. Here you can select yourgame_data folder to be included in the installer. This however does require an additional step. After adding the folder, you need to set the destination subfolder to yourgame_data for it to be able to properly create the subdirectories. You can refer to this picture guide for more information. I included the relevant step(s) below.

Include code in Inno Setup script that copies files to specifiable target directory

As I've never worked with Pascal before, I'm a bit lost trying to put some custom code into a Inno Setup .iss script ;-)
Upon running the installer, I'd like it to optionally copy a sub directory to a specifiable target destination (not to a sub directory below the installed software)
I had a look at this and this post, but it's a bit overwhelming. I do understand the "create aditional checkboxes" part, but how would I introduce a "choose directory" part and work with the result of it in order to copy files?
Following the example that Miral pointed to, could someone help me specify the actual copy function? I found this here, but I'm still lost with the Pascal way of doing things:
var‬‬
SourceF, DestF: TFileStream;
begin‬‬
‪SourceF:= TFileStream.Create('Photo.jpg', fmOpenRead);
‪DestF:= TFileStream.Create('PhotoCopy.jpg', fmCreate);
‪DestF.CopyFrom(SourceF, SourceF.Size);
SourceF.Free;
DestF.Free;
end;

Inno Setup - Conditional downloads based on tasks or components

I'm using Inno Setup 5.4.2 (a) to create a bootstrapper. Now I finally got it so that based on components selected the bootstrapper downloads the needed files for the components and then installs them.
However because the component files need to be downloaded it shows 0.1 mb diskspace needed and I would like it to show each individual size of the file to be downloaded in the select components screen.
I'm using InnoTools Downloader from http://www.sherlocksoftware.org and I've setup up function to get file size:
[Code]
var
setup: Double;
drivers: Double;
function ITD_GetFileSize(const url: string; var size:cardinal): boolean;
procedure InitializeWizard();
begin
itd_init;
ITD_GetFileSize('http://www.domain.com/file1.exe',setup);
ITD_GetFileSize('http://www.domain.com/drivers.exe',drivers);
end;
The files are downloaded after components selection (of course). The translation file I found
ComponentSize1=%1 KB
ComponentSize2=%1 MB
I've been searching for a method on how I can make it so that the file size is set correctly but can't seem to find it. With custom messages I might be able to set it once but then it won't work for both files.. I can't find any examples for using custom messages like this with passing a variable to it. Could any body help me out with this?
Thanks
Use the ExtraDiskSpaceRequired parameter to the [Components] entry to specify any space needed by external components.

How do I set file permissions for non-admin users in VB6?

I have an old update program written in vb6, which runs as admin. However, because it runs as admin, all the files it downloads and saves are read-only to other users. Even files in public places like the shared application data folder (which is where I'm saving the files in question).
I'm lucky I found this before the 'vista-compatible' release. Vista hides the problem by redirecting non-admin writes and future reads to a sortof 'virtual' folder. But the next update may replace the file, and the non-admin program will still go to the virtual folder and use the old file.
As the admin user, how do I allow other users full control of files I write in vb6?
The way I do this is to make it an Installer responsibility.
Use VSI 1.1 to create an Installer MSI for your application. Create an application data folder under CommonAppDataFolder.
As a post-build step run a script to perform the following:
Set the MSI database for a per-machine installation: Property table, row with ALLUSERS set to 1.
In the Directory table, locate the entry for CommonAppDataFolder and obtain its directory Index. Use this Index to query the Directory table for an entry where CommonAppDataFolder is the parent and obtain its Index (this is your app data subfolder).
Look in the File table to obtain the component Index of your program.
Create the CreateFolder table in the database if it isn't present. Add a row to CreateFolder for the desired application subdirectory by its Index, tying it to your program's component Index.
Create the LockPermissions table if it isn't present. Insert a new LockPermissions row for your application data subdirectory, giving it FILE_ALL_ACCESS for Everyone.
That's about it.
You can do it this way, or use VSI 1.1 and then edit the MSI using Orca, or probably by using a 3rd party MSI authoring tool these entries will be settable via its GUI and can be saved in the Installer project. I just use a small WSH script I run after each VSI 1.1 build.
AFAIK this is the recommended way of accomplishing such things according to Windows application guidelines. If your needs are fancier you might use multiple subdirectories or sub-subdirectories some allowing full access, some read-only, etc.
Your program can locate the folder using Shell Automation objects or by calling Shell32 as a standard DLL (using Declare Function or a TLB).
It's not necessarily who writes the file, but where they write it to. The program files folder and it's sub folders are read-only to all standard users by default. Try using the All Users Application Data folder instead.
This is a little tricky for VB6, since it was not at all designed with Vista in mind. Some of the relevant folders were re-named and there's no way I know to get vb6 to give you the exact folder you want short of using a "Declare Function" alias to call directly into the windows API.
So the easiest reliable way I know to find a suitable location is to use the %ALLUSERSPROFILE% environment variable. That returns "C:\Documents and Settings\All Users" by default on XP and "C:\ProgramData" by default on Vista. From there you can look for an "Application Data" folder. It won't be there and you don't need it on Vista, but creating one if it doesn't exist won't hurt anything. That gives you a consistent folder structure on both systems from which you can create a sub folder for your app to use as a work space.
And one final note: this isn't a new change for Vista. Program Files folders have always been read-only to standard users by default. XP worked the same way. It's just that so many people run as administrators in XP you might be able to get away with it.

Resources