From 43a545a67ea2b9673365745b1b5372170d730922 Mon Sep 17 00:00:00 2001 From: Thaler Benedek Date: Fri, 24 Sep 2021 16:49:07 +0200 Subject: [PATCH] Make diff_test work on windows with --enable_runfiles (#314) --- rules/diff_test.bzl | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/rules/diff_test.bzl b/rules/diff_test.bzl index acde2ea..ff570e6 100644 --- a/rules/diff_test.bzl +++ b/rules/diff_test.bzl @@ -44,16 +44,26 @@ for /F "tokens=2* usebackq" %%i in (`findstr.exe /l /c:"!F1! " "%MF%"`) do ( set RF1=!RF1:/=\\! ) if "!RF1!" equ "" ( - echo>&2 ERROR: !F1! not found - exit /b 1 + if exist "{file1}" ( + set RF1="{file1}" + set RF1=!RF1:/=\\! + ) else ( + echo>&2 ERROR: !F1! not found + exit /b 1 + ) ) for /F "tokens=2* usebackq" %%i in (`findstr.exe /l /c:"!F2! " "%MF%"`) do ( set RF2=%%i set RF2=!RF2:/=\\! ) if "!RF2!" equ "" ( - echo>&2 ERROR: !F2! not found - exit /b 1 + if exist "{file2}" ( + set RF2="{file2}" + set RF2=!RF2:/=\\! + ) else ( + echo>&2 ERROR: !F2! not found + exit /b 1 + ) ) fc.exe 2>NUL 1>NUL /B "!RF1!" "!RF2!" if %ERRORLEVEL% neq 0 (