#!/bin/sh
# set -x
# Change to this script directory
cd $(dirname "$0")

cd ..
PROJECT_DIR="$(pwd)"
BUILD_DIR="$PROJECT_DIR/target/wix"

BIN_NAME="tpnote"
EXE_NAME="$BIN_NAME.exe"
BIN_VERSION=$(grep -e '^version' Cargo.toml | sed 's/.*"\(.*\)".*/\1/')

rm -R "$BUILD_DIR"
mkdir "$BUILD_DIR"
chmod 777 "$BUILD_DIR"

cp "./tpnote/tpnote.ico" "$BUILD_DIR"
cp "./target/x86_64-pc-windows-gnu/release/$EXE_NAME" "$BUILD_DIR"
cp "./wix/tpnote.wxs" "$BUILD_DIR"

cd "$BUILD_DIR"
chmod 666 *
