#!/bin/sh

BIN_PATH=$(dirname "$0")
WINEPREFIX=$("$BIN_PATH/wine" --wait-children --bottle default winepath "C:\\")

VC_BINARY="$WINEPREFIX/windows/system32/msvcr120.dll"

if [ ! -e "$VC_BINARY" ]; then

    VC_INSTALLER=$("$BIN_PATH/wine" --bottle default winepath "C:\\msvc2013.exe")

    if [ ! -e "$VC_INSTALLER" ]; then
        "$BIN_PATH/wine" --wait-children cxwget http://download.microsoft.com/download/2/E/6/2E61CFA4-993B-4DD4-91DA-3737CD5CD6E3/vcredist_x86.exe c:\\msvc2013.exe
    fi

    "$BIN_PATH/wine" --wait-children c:\\msvc2013.exe
fi

"$BIN_PATH/wine" --bottle default --enable-alt-loader macdrv --wait-children "c:/Program Files/Audiokinetic/Wwise/Authoring/Win32/Release/bin/Wwise.exe"