#!/bin/bash

BINPATH=`readlink -f $0`
BASEPATH=`dirname $BINPATH`
WINEFOLDER="$BASEPATH/.wine"

# create wine folder
if [ ! -d $WINEFOLDER ]
then
    mkdir -p $WINEFOLDER
    # start a stub app to populate wine folder
    WINEPREFIX=$WINEFOLDER wineboot

    # remove wine's msvc dlls
    mv $WINEFOLDER/drive_c/windows/winsxs $WINEFOLDER/drive_c/windows/winsxs.old
fi

# start kiwix
WINEPREFIX=$WINEFOLDER wine kiwix.exe