
@echo off

rem
rem 1  absolute source directory
rem 2  file name (a directory)
rem 3  absolute installation directory
rem

set source_dir=%1%
set dir_name=%2%
set install_dir=%3%

if "%source_dir%"=="" exit /B 0
if "%dir_name%"=="" exit /B 0
if "%install_dir%"=="" exit /B 0

set dest_file_path=%install_dir%\%dir_name%
set ref_file=%dest_file_path%.cmtref
set full_source_name=%source_dir%\%dir_name%

cd %source_dir%

if %install_dir%=="" exit /B 0

if NOT exist %install_dir% echo "Cannot uninstall directory %dir_name%, no installation directory" & exit /B 0

echo Removing directory %dir_name% from %install_dir%

if exist %dest_file_path% rmdir /S/Q %dest_file_path%
if exist %ref_file% del %ref_file%
