Skip to content

Commit

Permalink
Better export.ps1
Browse files Browse the repository at this point in the history
Now, if you want to add this ps1 file to the $PATH without adding other scripts, like install.ps1, you can now just drag it in some empty directory and add it to the $PATH. Just define $IDF_PATH.  Suggestion to define $IDF_PATH was already in the script, but It didn't work because $IDF_PATH was just set to the root of the script ("$PSScriptRoot").
I also added more "clean" exit out of a script - it won't just scrap $IDF_PATH enviroment variable if it didn't find python scripts.
  • Loading branch information
SaintFTS authored Jan 14, 2025
1 parent cc9fb5b commit 372447c
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions export.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,22 @@ if ($env:ESP_IDF_LEGACY_EXPORT) {
exit $LASTEXITCODE
}

$idf_path = "$PSScriptRoot"
if ("$env:IDF_PATH" -ne "") {
$idf_path = "$env:IDF_PATH"
} else {
Write-Output "No IDF_PATH enviroment variable detected. Using the root directory as IDF_PATH"
$idf_path = "$PSScriptRoot"
}

if (-not (Test-Path "$idf_path/tools/idf.py") -or
-not (Test-Path "$idf_path/tools/idf_tools.py") -or
-not (Test-Path "$idf_path/tools/activate.py")) {

Write-Output "Could not detect IDF_PATH. Please navigate to your ESP-IDF directory and run:"
Write-Output ".\export.ps1"

$env:IDF_PATH = ""

Write-Output "`"$idf_path`" doesn't contain needed scripts. Please, add IDF_PATH enviroment variable:"
Write-Output ' $env:IDF_PATH=(add path here), '
Write-Output 'or navigate to your ESP-IDF directory and run:'
Write-Output ' .\export.ps1'
exit 1
}

Expand Down

0 comments on commit 372447c

Please sign in to comment.