
@echo off

rem
rem 1  absolute source directory
rem 2  file name
rem 3  absolute installation directory
rem

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

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

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

cd %source_dir%

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

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

rem echo Removing file %file_name% from %install_dir%

if exist %dest_file_path% del %dest_file_path%
if errorlevel 1 exit /B 1
if exist %ref_file% del %ref_file%
if errorlevel 1 exit /B 1
