Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tools: add option to disable path check #148

Merged
merged 5 commits into from
Oct 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Build-Installer.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ function CheckInnoSetupInstallation {
CheckInnoSetupInstallation

if ('espressif-ide' -eq $InstallerType) {
$EspIdfBranchVersion = $OfflineBranch.Replace('v', '')
$EspIdfBranchVersion = $OfflineBranch -replace '^v'
$OutputFileBaseName = "espressif-ide-setup-${InstallerType}-with-esp-idf-${EspIdfBranchVersion}-unsigned"
$OutputFileSigned = "espressif-ide-setup-${InstallerType}-with-esp-idf-${EspIdfBranchVersion}-signed.exe"
} else {
Expand All @@ -332,7 +332,7 @@ PrepareIdfEnv

if (('offline' -eq $InstallerType) -or ('espressif-ide' -eq $InstallerType)){
$IsccParameters += '/DOFFLINE=yes'
$IsccParameters += '/DOFFLINEBRANCH=' + $OfflineBranch.Replace('v', '')
$IsccParameters += '/DOFFLINEBRANCH=' + ($OfflineBranch -replace '^v')
$IsccParameters += '/DFRAMEWORK_ESP_IDF=' + $OfflineBranch

if (($OfflineBranch -like 'v4.1*') -or ($OfflineBranch -like 'v4.2*') ){
Expand Down Expand Up @@ -364,7 +364,7 @@ if (('offline' -eq $InstallerType) -or ('espressif-ide' -eq $InstallerType)){
$IsccParameters += '/DJDKARTIFACTVERSION=' + $JdkArtifactVersion
PrepareIdfEclipse
} else {
$IsccParameters += '/DVERSION=' + $OfflineBranch.Replace('v', '')
$IsccParameters += '/DVERSION=' + ($OfflineBranch -replace '^v')
$IsccParameters += '/DAPPNAME=ESP-IDF Tools Offline'
}
"${OfflineBranch}" > $Versions
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ Note: Online Installer is recommended way of the installation.

Windows Installer `esp-idf-tools-setup` provides the following command-line parameters:

* ``/CHECKPATH=[yes|no]`` - Check whether the installation path does not contain spaces or special characters or if it's too long. Set to ``no`` to disable checks. Default: yes.
* ``/CONFIG=[PATH]`` - Path to ``ini`` configuration file to override default configuration of the installer. Default: ``config.ini``.
* ``/GITCLEAN=[yes|no]`` - Perform git clean and remove untracked directories in Offline mode installation. Default: yes.
* ``/GITDEPTH=[number]`` - Clone repository in shallow mode E.g. 1. Default: empty.
Expand Down
2 changes: 2 additions & 0 deletions src/InnoSetup/Configuration.iss
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ var
IsGitRecursive: Boolean;
IsGitResetAllowed: Boolean;
IsGitCleanAllowed: Boolean;
IsCheckPathEnabled: Boolean;
IsPythonNoUserSite: Boolean;
IsOfflineMode: Boolean;
IDFDirectory: String;
Expand Down Expand Up @@ -70,6 +71,7 @@ begin

Log('Configuration /CONFIG=' + ConfigurationFile);

IsCheckPathEnabled := GetConfigurationBoolean('CHECKPATH', 'yes');
IsGitCleanAllowed := GetConfigurationBoolean('GITCLEAN', 'yes');
IsGitRecursive := GetConfigurationBoolean('GITRECURSIVE', 'yes');
IsGitResetAllowed := GetConfigurationBoolean('GITRESET', 'yes');
Expand Down
8 changes: 4 additions & 4 deletions src/InnoSetup/Environment.iss
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ begin
if IDFTempPath <> '' then
CmdLine := CmdLine + ' --reference ' + IDFTempPath;

CmdLine := CmdLine + ' ' + GitRepository +' ' + IDFPath;
CmdLine := CmdLine + ' ' + GitRepository +' "' + IDFPath + '"';
Log('Cloning IDF: ' + CmdLine);
DoCmdlineInstall(CustomMessage('DownloadingEspIdf'), CustomMessage('UsingGitToClone'), CmdLine);

Expand Down Expand Up @@ -353,7 +353,7 @@ end;
procedure IDFToolsSetup();
var
CmdLine: String;
IDFPath: String;
IdfPathWithForwardSlashes: String;
IDFToolsPyPath: String;
IDFToolsPyCmd: String;
BundledIDFToolsPyPath: String;
Expand All @@ -362,7 +362,7 @@ var
ResultCode: Integer;
TargetSupportTestCommand: String;
begin
IDFPath := GetIDFPath('');
IdfPathWithForwardSlashes := GetPathWithForwardSlashes(GetIDFPath(''));;
IDFToolsPyPath := GetIDFPath('tools\idf_tools.py');
BundledIDFToolsPyPath := ExpandConstant('{app}\idf_tools_fallback.py');
JSONArg := '';
Expand All @@ -388,7 +388,7 @@ begin
TargetSupportTestCommand := '"' + IDFToolsPyCmd + '" install --targets=""';

{ IDFPath not quoted, as it can not contain spaces }
IDFToolsPyCmd := PythonExecutablePath + ' "' + IDFToolsPyCmd + '" --idf-path ' + IDFPath + ' ' + JSONArg + ' ';
IDFToolsPyCmd := PythonExecutablePath + ' "' + IDFToolsPyCmd + '" --idf-path "' + IdfPathWithForwardSlashes + '" ' + JSONArg + ' ';

SetEnvironmentVariable('PYTHONUNBUFFERED', '1');

Expand Down
9 changes: 7 additions & 2 deletions src/InnoSetup/Pages/IdfDownloadPage.iss
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,11 @@ function IsDirNameValid(const Value: string): Boolean;
var
I: Integer;
begin
if not IsCheckPathEnabled then begin
Result := True;
Exit;
end;

Result := False;
for I := 1 to Length(Value) do
if not IsCharValid(Value[I]) then
Expand Down Expand Up @@ -147,14 +152,14 @@ begin
exit;
end;

if Pos(' ', IDFPath) <> 0 then
if (Pos(' ', IDFPath) <> 0) and IsCheckPathEnabled then
begin
MessageBox(CustomMessage('SpacesInPathNotSupported') + #13#10 +
CustomMessage('ChooseDifferentDirectory'), mbError, MB_OK);
exit;
end;

if (Length(IDFPath) > 90) then begin
if (Length(IDFPath) > 90) and IsCheckPathEnabled then begin
MessageBox(CustomMessage('ErrorTooLongIdfPath'), mbError, MB_OK);
Result := False;
exit;
Expand Down
4 changes: 2 additions & 2 deletions src/InnoSetup/Pages/IdfPage.iss
Original file line number Diff line number Diff line change
Expand Up @@ -91,14 +91,14 @@ begin
exit;
end;

if Pos(' ', IDFPath) <> 0 then
if (Pos(' ', IDFPath) <> 0) and IsCheckPathEnabled then
begin
MessageBox(CustomMessage('SpacesInPathNotSupported') + #13#10 +
CustomMessage('ChooseExistingEspIdfDirectory'), mbError, MB_OK);
exit;
end;

if (Length(IDFPath) > 90) then begin
if (Length(IDFPath) > 90) and IsCheckPathEnabled then begin
MessageBox(CustomMessage('ErrorTooLongIdfPath'), mbError, MB_OK);
Result := False;
exit;
Expand Down