How can I set relative path to ini file in ReadIni?
This works:
#define MyAppVersion ReadIni("C:\Users\Popov\Documents\Release\Install.ini", "Release", "VersionNumber")
But I want this:
#define MyAppVersion ReadIni("Install.ini", "Release", "VersionNumber")
Where Install.ini is in the inno script folder.
Use the SourcePath predefined variable, like this:
SourcePath str. Points to the directory where the current script is located, or the My Documents directory if the script has not yet been saved.
#define MyAppVersion ReadIni(SourcePath + "\Install.ini", "Release", "VersionNumber")
[Setup]
AppName=My Program
AppVersion={#MyAppVersion}
Related
For example nuitka3 (you can get it via pip3 install nuitka)
Does it just take the source code of your script and put it like this in a C file?
#include <string>
#include <cstdlib>
int main()
{
std::string src = "print(\"Hello world\")";
system(("python3.10 -c " + src).c_str());
}
and compiles it afterwards or converts it the script to assembly like a real compiler?
I am trying to sign my Inno Setup file. I get an exit error 0x1 ?? Here is the line I am using to configure the sign tool in Inno:
"c:\Digital certificate\signtool.exe" sign/a/t http://timestamp.digicert.com / f "c:\Digital cerificate\mycertificate.pfx"/p "mypassword"/d "C:\Flash projects\flash projects 2022\Reset\inno\reset setup file\ResetSetup.exe" $f
Is the syntax OK? I am not sure about the use of quotations when specifying file names, also the $f at the end of the command line? Do I need it?
Any links / examples to how to configure the signtool would be appreciated.
In Inno Setup I configure the Sign Tools:
SignTool="C:\Program Files (x86)\Windows Kits\10\bin\10.0.19041.0\x64\signtool.exe" sign $p
You would have to qualify the path to the signtool executable on your PC.
Then, in my script I have some definitions:
; SignTool parameters
#define SignedDesc "$qAppName$q"
#define SignedPfx "$qd:\My Certificate\2021\My Certificate.pfx$q"
#define SignedTimeStamp "$qhttp://timestamp.digicert.com$q"
;define SignedTimeStamp "$qhttp://timestamp.comodoca.com/authenticode$q"
;#define SignedTimeStamp "$qhttp://timestamp.globalsign.com/scripts/timestamp.dll$q"
;#define SignedTimeStamp "$qhttp://tsa.starfieldtech.com$q"
;#define SignedTimeStamp "$qhttp://timestamp.sectigo.com$q"
; The last server needs 15 seconds delay.
#define SignedPw "$qabc1234$q"
Adjust the values as required for your application etc..
In the [Setup] section (read more):
SignedUninstaller=yes
SignTool=SignTool /d {#SignedDesc} /du $q{#AppURL}$q /f {#SignedPfx} /p {#SignedPw} /t {#SignedTimeStamp} /v $f
SignToolRunMinimized=yes
SignToolMinimumTimeBetween=5000
In the [Files] section make sure you use either sign or signonce. Eg:
Source: "AppRestarter.exe"; DestDir: "{app}"; Flags: IgnoreVersion signonce
I want to pass a path (via command line arg /D to the script compiler) to my executable to let my script determine the application version number using GetFileVersion, but my syntax isn't correct. How do I pass an argument to GetFileVersion?
The error is: Illegal character in input file: '#' (0x23)
#define srcpath SOURCEPATH
#define ApplicationVersion GetFileVersion(#srcpath)//error here!!!!!!
[Setup]
AppVersion={#ApplicationVersion}
[Files]
Source: "MyDllTesting.dll"; Flags: dontcopy
Source: "{srcpath}MyApplication1.exe"; DestDir: "{app}\MyApplication1"
First, SOURCEPATH is a Inno Setup preprocessor predefined variable, so you need to use another name for your command-line "variable". I'll be using SOURCE_PATH.
Second, the correct syntax is:
#define ApplicationVersion GetFileVersion(SOURCE_PATH)
(i.e. no hash)
Why no hash, is covered in my answer to
Why preprocessor behaves differently in #include directive then in [Files] section Inno Setup script
Though the reason is basically the same, why you use no hash before SOURCEPATH here:
#define srcpath SOURCEPATH
On the contrary you are missing the hash in the [Files] section entry. The correct syntax is:
[Files]
Source: "{#srcpath}MyApplication1.exe"; DestDir: "{app}\MyApplication1"
And there's no need to define srcpath variable. SOURCE_PATH is variable too. So you can use it directly in any expression:
#define ApplicationVersion GetFileVersion(SOURCE_PATH)
[Files]
Source: "{#SOURCE_PATH}MyApplication1.exe"; DestDir: "{app}\MyApplication1"
From the docs on "Inno Setup Preprocessor: Command Line Compiler Execution" I could define a command line parameter called "MyCustomParam" by using /D option like this:
.\ISCC.exe /DMyCustomParam=MyParamValue "MySetupScript.iss"
and then I wrote my setup script like the following, which gets the value which was defined for the parameter on the command line:
[Setup]
AppName={#MyCustomParam}
I have an Inno Setup script which looks for a file as a preprocessor step:
#define a_path GetEnv("INSTALLER_FILES")
#define install_file FindFirst(a_path + "\pattern*.*")
When the install_file is not found, I would like to emit an error:
#if install_file == 0
#error No installer found at {#a_path}
#endif
But the ISPP only writes the literal source line on compilation:
script.iss: [ISPP] No installer found at {#a_path}
Is it possible to expand a preprocessor variable in the #error directive?
The argument of the #error directive cannot contain variables.
But you can use the #pragma error directive instead:
#pragma error "No installer found at " + a_path
I am programming for a big project, so I cooperate with others. To make the directory easily managed, my directory is like below:
project:
--include (header files from others supplied for me)
--lib (libraries from others supplied for me)
--L3_CVS (this folder include all my files)
-- Makefile
-- sourceFile (all my source files here)
-- include_private(all header files used only by myself)
-- appl (all my C files here)
if I want to include a .h file in my .c file, do I need to write in .c file " #include "../include-private/XX.h" "???
what if i just write in .c " include "XX.h" "?
Because I need to use the .h files in "include folder" which others supply for me, how could I write in my .c files to include these .h files??
my makefile is below:
how to include .h document in makefile
thank you for your help!!!
Depends on the compiler, but typically, you'll want to add the following line:
CFLAGS += -I../include-private
CFLAGS is a variable that make uses to add command-line options for the C compiler ("C" flags). For C++, you need to use CXXFLAGS. If I'm using C and C++ in the same project, I'll typically create a variable called INCLUDES, and use it like this:
INCLUDES = -I../include-private
CFLAGS += $(INCLUDES)
CXXFLAGS += $(INCLUDES)