You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using the example/menu_script.ps1 on a linux based filesystem with forward slash for folder separation, the "ExitOption" will never be shown after leaving the starting folder of the menu tree.
This is most likely due to the code in line 33 "if ($current_menu_location -eq $menu_menu_dir) {" which will never be true once changing the menu, as $menu_menu_dir will have a backslash in its path while the $current_menu_location will have a forward slash.
As a result, the menu never shows ExitOption. It will crash once going higher in the menu tree than $menu_menu_dir.
As a solution I recommend to change the way the paths are built:
in /example/vars/menu_vars.ps1 the $menu_menu_dir is built like this, including a backslash:
$menu_menu_dir = $menu_script_root_dir + '\Example PowerShell CLI Menu' # The path to the menu structure
To work around the issue of a slash, the path should be build with Join-Path:
$menu_menu_dir = Join-Path -Path $menu_script_root_dir -ChildPath 'Example PowerShell CLI Menu' # The path to the menu structure
The issue was experienced and fix tested using it within a Docker container on Windows using WSL2.
As paths are built at different parts of the script maybe change all the build processes to Join-Path.
The text was updated successfully, but these errors were encountered:
Uh oh!
There was an error while loading. Please reload this page.
When using the example/menu_script.ps1 on a linux based filesystem with forward slash for folder separation, the "ExitOption" will never be shown after leaving the starting folder of the menu tree.
This is most likely due to the code in line 33 "if ($current_menu_location -eq $menu_menu_dir) {" which will never be true once changing the menu, as $menu_menu_dir will have a backslash in its path while the $current_menu_location will have a forward slash.
As a result, the menu never shows ExitOption. It will crash once going higher in the menu tree than $menu_menu_dir.
As a solution I recommend to change the way the paths are built:
in /example/vars/menu_vars.ps1 the $menu_menu_dir is built like this, including a backslash:
$menu_menu_dir = $menu_script_root_dir + '\Example PowerShell CLI Menu' # The path to the menu structure
To work around the issue of a slash, the path should be build with Join-Path:
$menu_menu_dir = Join-Path -Path $menu_script_root_dir -ChildPath 'Example PowerShell CLI Menu' # The path to the menu structure
The issue was experienced and fix tested using it within a Docker container on Windows using WSL2.
As paths are built at different parts of the script maybe change all the build processes to Join-Path.
The text was updated successfully, but these errors were encountered: