tools: installer: fix quoting of IDF_TOOLS_PATH
IDF_TOOLS_PATH may contain spaces, so needs to be properly quoted. Closes https://github.com/espressif/esp-idf/issues/3807
This commit is contained in:
parent
606c6c867c
commit
aaf3dcbda0
2 changed files with 9 additions and 7 deletions
|
@ -18,8 +18,8 @@ if "%~2"=="" (
|
||||||
goto :end
|
goto :end
|
||||||
)
|
)
|
||||||
|
|
||||||
set IDF_PYTHON_DIR=%1
|
set "IDF_PYTHON_DIR=%1"
|
||||||
set IDF_GIT_DIR=%2
|
set "IDF_GIT_DIR=%2"
|
||||||
|
|
||||||
:: Strip quoutes
|
:: Strip quoutes
|
||||||
set "IDF_PYTHON_DIR=%IDF_PYTHON_DIR:"=%"
|
set "IDF_PYTHON_DIR=%IDF_PYTHON_DIR:"=%"
|
||||||
|
@ -69,7 +69,7 @@ echo Adding ESP-IDF tools to PATH...
|
||||||
:: It is possible to do this without a temporary file (running idf_tools.py from for /r command),
|
:: It is possible to do this without a temporary file (running idf_tools.py from for /r command),
|
||||||
:: but that way it is impossible to get the exit code of idf_tools.py.
|
:: but that way it is impossible to get the exit code of idf_tools.py.
|
||||||
set "IDF_TOOLS_EXPORTS_FILE=%TEMP%\idf_export_vars.tmp"
|
set "IDF_TOOLS_EXPORTS_FILE=%TEMP%\idf_export_vars.tmp"
|
||||||
python.exe %IDF_TOOLS_PY_PATH% --tools-json %IDF_TOOLS_JSON_PATH% export --format key-value >"%IDF_TOOLS_EXPORTS_FILE%"
|
python.exe "%IDF_TOOLS_PY_PATH%" --tools-json "%IDF_TOOLS_JSON_PATH%" export --format key-value >"%IDF_TOOLS_EXPORTS_FILE%"
|
||||||
if %errorlevel% neq 0 goto :end
|
if %errorlevel% neq 0 goto :end
|
||||||
|
|
||||||
for /f "usebackq tokens=1,2 eol=# delims==" %%a in ("%IDF_TOOLS_EXPORTS_FILE%") do (
|
for /f "usebackq tokens=1,2 eol=# delims==" %%a in ("%IDF_TOOLS_EXPORTS_FILE%") do (
|
||||||
|
|
|
@ -142,7 +142,7 @@ begin
|
||||||
end;
|
end;
|
||||||
|
|
||||||
ExtractTemporaryFile('7za.exe')
|
ExtractTemporaryFile('7za.exe')
|
||||||
CmdLine := ExpandConstant('{tmp}\7za.exe x -o' + ExpandConstant('{tmp}') + ' -r -aoa ' + IDFZIPFileName);
|
CmdLine := ExpandConstant('{tmp}\7za.exe x -o' + ExpandConstant('{tmp}') + ' -r -aoa "' + IDFZIPFileName + '"');
|
||||||
IDFTempPath := ExpandConstant('{tmp}\esp-idf-') + IDFZIPFileVersion;
|
IDFTempPath := ExpandConstant('{tmp}\esp-idf-') + IDFZIPFileVersion;
|
||||||
Log('Extracting ESP-IDF reference repository: ' + CmdLine);
|
Log('Extracting ESP-IDF reference repository: ' + CmdLine);
|
||||||
Log('Reference repository path: ' + IDFTempPath);
|
Log('Reference repository path: ' + IDFTempPath);
|
||||||
|
@ -212,9 +212,9 @@ begin
|
||||||
end else begin
|
end else begin
|
||||||
Log('idf_tools.py does not exist in IDF directory, using a fallback version');
|
Log('idf_tools.py does not exist in IDF directory, using a fallback version');
|
||||||
IDFToolsPyCmd := ExpandConstant(PythonExecutablePath
|
IDFToolsPyCmd := ExpandConstant(PythonExecutablePath
|
||||||
+ ' {app}\idf_tools_fallback.py'
|
+ ' "{app}\idf_tools_fallback.py"'
|
||||||
+ ' --idf-path ' + IDFPath
|
+ ' --idf-path ' + IDFPath
|
||||||
+ ' --tools {app}\tools_fallback.json');
|
+ ' --tools "{app}\tools_fallback.json"');
|
||||||
end;
|
end;
|
||||||
|
|
||||||
Log('idf_tools.py command: ' + IDFToolsPyCmd);
|
Log('idf_tools.py command: ' + IDFToolsPyCmd);
|
||||||
|
@ -238,7 +238,9 @@ begin
|
||||||
ForceDirectories(ExpandConstant('{group}'));
|
ForceDirectories(ExpandConstant('{group}'));
|
||||||
Destination := ExpandConstant('{group}\{#IDFCmdExeShortcutFile}');
|
Destination := ExpandConstant('{group}\{#IDFCmdExeShortcutFile}');
|
||||||
Description := '{#IDFCmdExeShortcutDescription}';
|
Description := '{#IDFCmdExeShortcutDescription}';
|
||||||
Command := ExpandConstant('/k {app}\idf_cmd_init.bat "') + PythonPath + '" "' + GitPath + '"';
|
{ If cmd.exe command argument starts with a quote, the first and last quote chars in the command
|
||||||
|
will be removed by cmd.exe; each argument needs to be surrounded by quotes as well. }
|
||||||
|
Command := ExpandConstant('/k ""{app}\idf_cmd_init.bat" "') + PythonPath + '" "' + GitPath + '""';
|
||||||
Log('CreateShellLink Destination=' + Destination + ' Description=' + Description + ' Command=' + Command)
|
Log('CreateShellLink Destination=' + Destination + ' Description=' + Description + ' Command=' + Command)
|
||||||
try
|
try
|
||||||
CreateShellLink(
|
CreateShellLink(
|
||||||
|
|
Loading…
Reference in a new issue