D.Cook
Member
I've recently started using the useful Progress STandard Libraries (http://www.oehive.org/project/lib), and found a need to xcode the whole thing so that I can compile on a linux server with no ABL licence. (Some files need to be compiled on the target OS).
So, instead of asking if anyone has a script to recursively xcode a folder, or just manually doing it (which would have been way quicker), I wrote my own. See below.
Note that this xcodes all files, because some include files do not have a file extension. Please update the script if you can change it to xcode only progress source (.p,.i and no extensions) and copy other files (.sh,.bat,.pdf etc)
So, instead of asking if anyone has a script to recursively xcode a folder, or just manually doing it (which would have been way quicker), I wrote my own. See below.
Note that this xcodes all files, because some include files do not have a file extension. Please update the script if you can change it to xcode only progress source (.p,.i and no extensions) and copy other files (.sh,.bat,.pdf etc)
Code:
@echo off
if '%1'=='/?' (
echo Recursively xcode all files REM Progress source files ^(.p, .i, .w^).
echo Also copies other non-Progress files.
echo d.cook 19/04/2012
echo Params: 1 - Folder to xcode
echo 2 - Output Directory
exit /b
)
SETLOCAL ENABLEDELAYEDEXPANSION
if '%DLC%'=='' SET DLC=O:\Applications\progress\dlc102b
REM SET PATH=%PATH%;%DLC%\bin
SET INDIR=%1
SET OUTDIR=%2
::Confirm input and output dir
if '%INDIR%'=='' set INDIR=%CD%
echo Input directory: %INDIR%
if '%OUTDIR%'=='' ( set /P OUTDIR=Enter output directory:
) else echo Output directory: %~dpnx2
pause
::Get String Length (http://stackoverflow.com/a/8566001/421243)
ECHO %INDIR%> %TEMP%\%~n0.txt
FOR %%? IN (%TEMP%\%~n0.txt) DO ( SET /A STRLEN=%%~z? - 1 )
DEL %TEMP%\%~n0.txt
pushd "%INDIR%"
::Ensure clean output dir
if exist "%OUTDIR%" rmdir /s /q "%OUTDIR%"
mkdir "%OUTDIR%"
echo Xcoding...
::For each subdirectory (not hidden)
FOR /F "tokens=*" %%G in ('dir /B /S /AD-H "%INDIR%" 2^>nul') DO (
REM echo %%G
set FILEPATH=%%~G
set FILEPATH=!FILEPATH:~%STRLEN%!
::Create subdir in output dir
mkdir %OUTDIR%\!FILEPATH!
::Xcode files in this dir
%DLC%\bin\xcode -d "%OUTDIR%" -l "!FILEPATH!\*" >nul
REM %DLC%\bin\xcode -d "%OUTDIR%" -l "!FILEPATH!\*.p" "!FILEPATH!\*.i" "!FILEPATH!\*.w" >nul
)
popd
echo Done^!
sleep 3