#!/bin/bash

appScanAvailable()
{
    if [ -d "$install_containers_dir" ]; then
        echo ""
        echo "Folders in $install_containers_dir:"
        echo ""
        for folder in "$install_containers_dir"/*/; do
            local folder_name=$(basename "$folder")
            local config_file="$folder/${folder_name}.config"
            if [ -f "$config_file" ]; then
                local category_var="CFG_${folder_name^^}_CATEGORY"
                local title_var="CFG_${folder_name^^}_TITLE"
                local description_var="CFG_${folder_name^^}_DESCRIPTION"
                local category="${!category_var}"
                local title="${!title_var}"
                local description="${!description_var}"
                if [ -n "$folder_name" ] && [ -n "$category" ]; then
                    echo "$category - $title ($description)"
                fi
            else
                echo "No ${folder_name}.config file found in $folder"
            fi
        done
    else
        isError "$folder_name is not a valid application."
    fi
}
