<commit_before>#!/bin/bash
CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
source "$CURRENT_DIR"/script-dialog/script-dialog.sh #folder local version

relaunchIfNotVisible

APP_NAME="Test Script"
if [[ -e "$CURRENT_DIR/game.png" ]]; then
  WINDOW_ICON="$CURRENT_DIR/game.png"
else
  WINDOW_ICON="$CURRENT_DIR/game.png.example"
fi


if [[ $# -eq 0 ]] ; then
  ACTIVITY="Data Directory Discovery"
  messagebox "Select gameinfo.conf"
  DATA_DIR=$(dirname "$(filepicker "$CURRENT_DIR" "open")")
else
    DATA_DIR="$1"
fi

if [ "$DATA_DIR" == "" ]; then
  exit 0;
fi

if [[ -f "$DATA_DIR/game.png" ]]; then
    WINDOW_ICON="$DATA_DIR/game.png"
fi

GAMEFOLDER=$(find "$DATA_DIR" ! -path "*_i386*" ! -path "*_amd64/*" ! -path "*.app*" -name 'Game.exe' -printf '%h\n' | sort -ur | tr -d '\n' | tr -d '\r')

if [[ ! -d "$GAMEFOLDER" ]]; then
    messagebox "No game folder found inside \"$DATA_DIR\""
    exit 31;
fi

ACTIVITY="Build Outputs"
ANSWER=($(checklist "What outputs do you want to build? " 5  \
                "deb32" "Linux: 32-bit Debian Package" ON\
                "deb64" "Linux: 64-bit Debian Package" ON\
                "win" "Windows: NSIS Installer" ON\
                "macdmg" "macOS: DMG with App Bundle and more inside" ON\
                "maczip" "macOS: Zipped App Bundle" OFF ))

if [[ "${ANSWER[@]}" == "" ]]; then
  exit 0;
fi

if [[ " ${ANSWER[@]} " =~ "macdmg" ]] || [[ " ${ANSWER[@]} " =~ "maczip" ]]; then
    MKXP_MAC="mkxp-6-8-2018-withrubyzlib.zip"

    if [[ ! -f "$CURRENT_DIR/$MKXP_MAC" ]]; then
        messagebox "Please '$MKXP_MAC' download from 'https://app.box.com/v/mkxpmacbuilds' to \"$CURRENT_DIR\"."
        exit 32;
    fi
fi

ACTIVITY="Building ${#ANSWER[*]} items..."
{
  progressbar_update 1

  if [[ " ${ANSWER[@]} " =~ "deb32" ]] && [[ " ${ANSWER[@]} " =~ "deb64" ]]; then
    bash build-debian.sh "$DATA_DIR" "both"
  elif [[ " ${ANSWER[@]} " =~ "deb32" ]]; then
    bash build-debian.sh "$DATA_DIR" "32"
  elif [[ " ${ANSWER[@]} " =~ "deb64" ]]; then
    bash build-debian.sh "$DATA_DIR" "64"
  fi
  progressbar_update 40

  if [[ " ${ANSWER[@]} " =~ "macdmg" ]] && [[ " ${ANSWER[@]} " =~ "maczip" ]]; then
    bash build-macOS.sh "$DATA_DIR" "both"
  elif [[ " ${ANSWER[@]} " =~ "macdmg" ]]; then
    bash build-macOS.sh "$DATA_DIR" "dmg"
  elif [[ " ${ANSWER[@]} " =~ "maczip" ]]; then
    bash build-macOS.sh "$DATA_DIR" "zip"
  fi
  progressbar_update 80

  if [[ " ${ANSWER[@]} " =~ "win" ]]; then
    bash build-windows.sh "$DATA_DIR"
  fi
  progressbar_update 100

  sleep 1
} | progressbar
progressbar_finish

messagebox "Finished building."<commit_msg>fixes for new progressbar api in script-dialog<commit_after>#!/bin/bash
CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
source "$CURRENT_DIR"/script-dialog/script-dialog.sh #folder local version

relaunchIfNotVisible

APP_NAME="Test Script"
if [[ -e "$CURRENT_DIR/game.png" ]]; then
  WINDOW_ICON="$CURRENT_DIR/game.png"
else
  WINDOW_ICON="$CURRENT_DIR/game.png.example"
fi


if [[ $# -eq 0 ]] ; then
  ACTIVITY="Data Directory Discovery"
  messagebox "Select gameinfo.conf"
  DATA_DIR=$(dirname "$(filepicker "$CURRENT_DIR" "open")")
else
    DATA_DIR="$1"
fi

if [ "$DATA_DIR" == "" ]; then
  exit 0;
fi

if [[ -f "$DATA_DIR/game.png" ]]; then
    WINDOW_ICON="$DATA_DIR/game.png"
fi

GAMEFOLDER=$(find "$DATA_DIR" ! -path "*_i386*" ! -path "*_amd64/*" ! -path "*.app*" -name 'Game.exe' -printf '%h\n' | sort -ur | tr -d '\n' | tr -d '\r')

if [[ ! -d "$GAMEFOLDER" ]]; then
    messagebox "No game folder found inside \"$DATA_DIR\""
    exit 31;
fi

ACTIVITY="Build Outputs"
ANSWER=($(checklist "What outputs do you want to build? " 5  \
                "deb32" "Linux: 32-bit Debian Package" ON\
                "deb64" "Linux: 64-bit Debian Package" ON\
                "win" "Windows: NSIS Installer" ON\
                "macdmg" "macOS: DMG with App Bundle and more inside" ON\
                "maczip" "macOS: Zipped App Bundle" OFF ))

if [[ "${ANSWER[@]}" == "" ]]; then
  exit 0;
fi

if [[ " ${ANSWER[@]} " =~ "macdmg" ]] || [[ " ${ANSWER[@]} " =~ "maczip" ]]; then
    MKXP_MAC="mkxp-6-8-2018-withrubyzlib.zip"

    if [[ ! -f "$CURRENT_DIR/$MKXP_MAC" ]]; then
        messagebox "Please '$MKXP_MAC' download from 'https://app.box.com/v/mkxpmacbuilds' to \"$CURRENT_DIR\"."
        exit 32;
    fi
fi

ACTIVITY="Building ${#ANSWER[*]} items..."
{
  progressbar_update 1

  if [[ " ${ANSWER[@]} " =~ "deb32" ]] && [[ " ${ANSWER[@]} " =~ "deb64" ]]; then
    bash build-debian.sh "$DATA_DIR" "both"
  elif [[ " ${ANSWER[@]} " =~ "deb32" ]]; then
    bash build-debian.sh "$DATA_DIR" "32"
  elif [[ " ${ANSWER[@]} " =~ "deb64" ]]; then
    bash build-debian.sh "$DATA_DIR" "64"
  fi
  progressbar_update 40

  if [[ " ${ANSWER[@]} " =~ "macdmg" ]] && [[ " ${ANSWER[@]} " =~ "maczip" ]]; then
    bash build-macOS.sh "$DATA_DIR" "both"
  elif [[ " ${ANSWER[@]} " =~ "macdmg" ]]; then
    bash build-macOS.sh "$DATA_DIR" "dmg"
  elif [[ " ${ANSWER[@]} " =~ "maczip" ]]; then
    bash build-macOS.sh "$DATA_DIR" "zip"
  fi
  progressbar_update 80

  if [[ " ${ANSWER[@]} " =~ "win" ]]; then
    bash build-windows.sh "$DATA_DIR"
  fi
  progressbar_update 100
  sleep 0.2
  progressbar_finish
} | progressbar

messagebox "Finished building."
{'fraction_non_alphanumeric': 0.20756143667296786, 'fraction_numerical': 0.019092627599243857, 'mean_word_length': 3.179304897314376, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3323304', 'n_tokens_mistral': 2217, 'n_tokens_neox': 2035, 'n_words': 481}