A question about InnoSetup

Can someone tell me if the “You” in the following line from InnoSetup script translate the the actual name of the User?

Source: "C:\\Users\\You\\Development\\XojoApp\\BuildsFolder\\Windows\\XojoApp Libs\\*"; DestDir: "{app}\\XojoApp Libs"; Flags: ignoreversion recursesubdirs createallsubdirs

Also, if I wanted to store a database file in the AppData folder, how would I do that? Is the AppData folder the best place for a Read Only database?

Yes, the “You” in the path should be replaced with the actual account name for the user.

I generally prefer to have the app itself create (or copy) the DB to AppData. If you wanted the installer to do it, I suspect it would involve the same types of Source/DestDir settings.

Hi Paul

Thanks for your reply. Please excuse my ignorance in these matters. You say:

You do mean that InnoSetup will do that automatically as it runs I hope, as I have no way of knowing in advance what the account name could be.

That line runs on your machine when you build the installer, not on the end user’s machine when they install. It identifies where to find the source files on your machine. Note that you will also need to replace “XojoApp” with the actual name of your app. You might have to replace the entire path if you’re building somewhere else.

Where did you get this sample?

Hi Tim

From here:

link text

You need to replace “XojoApp” and any path that begins with “C:”. The paths are where you compiled the app on your machine. They may be vastly different, especially if you’ve turned off the option to use the build directory.

Here is my InnoSetup script:

[code]; Script generated by the Inno Setup Script Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!

[Setup]
; NOTE: The value of AppId uniquely identifies this application.
; Do not use the same AppId value in installers for other applications.
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
AppId={{DBF2254A-F176-4FD9-9922-C33F2C340622}
AppName=Classes Selection
AppVersion=1.0
;AppVerName=Classes Selection 1.0
AppPublisher=Arnold Acres Design
AppPublisherURL=http://www.arnoldacres.co.nz
AppSupportURL=http://www.arnoldacres.co.nz
AppUpdatesURL=http://www.arnoldacres.co.nz
DefaultDirName={pf}\Classes Selection
DisableDirPage=yes
DefaultGroupName=Classes Selection
DisableProgramGroupPage=yes
OutputDir=C:\Users\cliffgs\Desktop
OutputBaseFilename=Classes Setup
Compression=lzma
SolidCompression=yes

[Languages]
Name: “english”; MessagesFile: “compiler:Default.isl”

[Tasks]
Name: “desktopicon”; Description: “{cm:CreateDesktopIcon}”; GroupDescription: “{cm:AdditionalIcons}”; Flags: unchecked

[Files]
Source: “C:\Users\cliffgs\PoultryClubProject\Builds - Classes Selection.xojo_binary_project\Windows\Classes Selection\Classes Selection.exe”; DestDir: “{app}”; Flags: ignoreversion
Source: “C:\Users\cliffgs\PoultryClubProject\Database\Poultry\"; DestDir: “{app}”; Flags: ignoreversion recursesubdirs createallsubdirs
Source: "C:\Users\cliffgs\PoultryClubProject\Builds - Classes Selection.xojo_binary_project\Windows\Classes Selection\Classes Selection Libs\
”; DestDir: “{app}”; Flags: ignoreversion recursesubdirs createallsubdirs
Source: “C:\Users\cliffgs\PoultryClubProject\Graphics\SI.png”; DestDir: “{app}”; Flags: ignoreversion
; NOTE: Don’t use “Flags: ignoreversion” on any shared system files

[Icons]
Name: “{group}\Classes Selection”; Filename: “{app}\Classes Selection.exe”
Name: “{commondesktop}\Classes Selection”; Filename: “{app}\Classes Selection.exe”; Tasks: desktopicon

[Run]
Filename: “{app}\Classes Selection.exe”; Description: “{cm:LaunchProgram,Classes Selection}”; Flags: nowait postinstall skipifsilent

[/code]

I used the Wizard to setup the script.

The Installation program works perfectly if I am prepared to put the database file manually into the AppData folder, but that is not an option because some remote people may have to install this, and they may not know how to get to their AppData folder. (I have tried in this script putting the database file in the app folder, but that doesn’t seem to work either.

Sorry to reply to myself. But on reading the previous post I guess I am putting the database file directly in the app folder. I will attempt to change that to where I have it installed in the Xojo Project and where I am targeting it in the program.

Use {appdata} in your script to refer to the user’s ApplicationData directory.

I had already tried that, it gave an error (Unknown constant). I found in the docs {userappdata), that didn’t give any errors in the script, but it also didn’t load the database file into AppData.

I can get the installer program to work and actually install the program, except for the database file. I think I will quit while I’m ahead and have the installer create the program and the user can manually put the database fill in their own AppData folder. This program is for a club, and I know most of the members of the club - I am sure I can give explicit enough details on how to do that small job.

Just as a final question, would it be OK to stuff the database file inside the

Many thanks for all your help Tim I don’t want to waste any more of your time (or mine). Perhaps later I will have more time to study InnoSet more closely and try and resolve this issue.

If you can get the installer to stick the database next to the app, then you can copy the database into ApplicationData if it doesn’t already exist there. (Paul’s suggestion)

I had a quick look at the Eddies Electronics sample project that came with Xojo. I noticed that the two database files were in the same folder as the xojo binary file.

So I put my database in the same file as my xojo binary file, built the app for Windows and then set up InnoSetup. After installing the app, it started without complaining it couldn’t find the database and so worked! When I looked inside the folder in Program Files the database is sitting in that folder along with the app.

I really don’t care where this file is as long as the program works (which it does now) so I am going to leave it there without trying the move it to the ApplicationData folder.

Thank you so much for your help. My first program in Xojo and first ever that I have written for Windows is now working.

On Windows, c:\ProgramData\YourApplicationDirectory is a good place to put a database. The InnoSetup info is below

Source: “some path and file”; DestDir: “{commonappdata}\DirectoryName”; Flags: ignoreversion; Permissions: users-modify

The Xojo code to find the database is

f=SpecialFolder.SharedApplicationData
If f <> Nil Then
  app.helpString=f.AbsolutePath  + webAdd + "\"
  app.cnnStr = f.AbsolutePath  + webAdd + "\" + dbName
Else
  MsgBox("The configuration file is missing.")
End If

webAdd is the name of the directory in c:\ProgramData where I put the database