@echo off

rem make sure the initial working directory is the one containing the current script
SET scriptPath=%~dp0
SET initialWD=%CD%
cd %scriptPath%

cd ..

rd /s /q package
mkdir package
cd package
mkdir GameData
cd GameData

mkdir Aerostats
cd Aerostats
xcopy /y ..\..\..\License.txt .
xcopy /y ..\..\..\resources.cfg .
xcopy /y ..\..\..\TweakScale.cfg .

mkdir Plugin
xcopy /y ..\..\..\Plugin\bin\Release\Aerostats.dll Plugin

mkdir Parts
cd Parts

mkdir HeliumBalloon
xcopy /y ..\..\..\..\Parts\HeliumBalloon\heliumBalloon.cfg HeliumBalloon
xcopy /y ..\..\..\..\Parts\HeliumBalloon\model.mu HeliumBalloon
xcopy /y ..\..\..\..\Parts\HeliumBalloon\model000.dds HeliumBalloon
xcopy /y ..\..\..\..\Parts\HeliumBalloon\model001.dds HeliumBalloon

mkdir HeliumTankRadial
xcopy /y ..\..\..\..\Parts\HeliumTankRadial\heliumTankRadial.cfg HeliumTankRadial
xcopy /y ..\..\..\..\Parts\HeliumTankRadial\model.mu HeliumTankRadial
xcopy /y ..\..\..\..\Parts\HeliumTankRadial\ksp_r_xenonTank_diff.dds HeliumTankRadial

mkdir HeliumTank
xcopy /y ..\..\..\..\Parts\HeliumTank\heliumTank.cfg HeliumTank
xcopy /y ..\..\..\..\Parts\HeliumTank\model.mu HeliumTank
xcopy /y ..\..\..\..\Parts\HeliumTank\tank.dds HeliumTank

cd "%scriptPath%..\package"
IF EXIST ..\Aerostats.zip del ..\Aerostats.zip
"%scriptPath%7z.exe" a ..\Aerostats.zip GameData
cd "%scriptPath%.."
rd /s /q package

cd %initialWD%

pause
