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

fix gpt path #789

Merged
merged 2 commits into from
Sep 15, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 11 additions & 1 deletion modules/Q02_openai_question.sh
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,17 @@ ask_chatgpt() {
# in case we have nothing we are going to move on
[[ -z "${SCRIPT_PATH_TMP_}" ]] && continue
print_output "[*] Identification of ${ORANGE}${SCRIPT_PATH_TMP_} / ${GPT_INPUT_FILE_}${NC} inside ${ORANGE}${LOG_DIR}/firmware${NC}" "no_log"
SCRIPT_PATH_TMP_="$(find "${LOG_DIR}/firmware" -wholename "*${SCRIPT_PATH_TMP_}")"
if [[ "${SCRIPT_PATH_TMP_}" == ".""${LOG_DIR}"* ]]; then
print_output "[*] Warning: System path is not stripped with the root directory - we try to fix it now" "no_log"
# remove the '.'
SCRIPT_PATH_TMP_="${SCRIPT_PATH_TMP_:1}"
# remove the LOG_DIR
# shellcheck disable=SC2001
SCRIPT_PATH_TMP_="$(echo "${SCRIPT_PATH_TMP_}" | sed 's#'"${LOG_DIR}"'##')"
print_output "[*] Stripped path $SCRIPT_PATH_TMP_" "no_log"
fi
# dirty fix - Todo: use array in future
SCRIPT_PATH_TMP_="$(find "${LOG_DIR}/firmware" -wholename "*${SCRIPT_PATH_TMP_}" | head -1)"

# in case we have nothing we are going to move on
! [[ -f "${SCRIPT_PATH_TMP_}" ]] && continue
Expand Down