#!/bin/sh -x

binpath=$(echo $1 | sed 's,/usr/i686-w64-mingw32/sys-root/mingw/.*,/usr/i686-w64-mingw32/sys-root/mingw/bin,g')
rootdir=$HOME/.wine/.qmlpluginexports
if ! test -d $rootdir$binpath; then
    # init binary search path
    ci_host=i686-w64-mingw32 . /usr/lib/rpm/mingw32-cross-wine-wine.sh $binpath
    # delete previous setting
    rm -rf $rootdir
    # add hint that path has been set
    mkdir -p $rootdir$binpath
fi

# list provides
/usr/bin/wine /usr/i686-w64-mingw32/sys-root/mingw/bin/qmlpluginexports-qt5.exe $* | sed 's,\r,,g'
exit 0
