0029009: Configuration - provide a way to get visual dif of SVG images
[occt.git] / adm / svgdiff.bat
1 @echo off
2 rem Script to diff SVG images visually (as PNG) in TortoiseGit client
3 rem 
4 rem It assumes that Inkscape and TortoiseGitIDiff executables are either 
5 rem installed in default locations in Program Files, or are accessible by PATH
6 rem 
7 rem To use this script for diffing SVG images, open TortoiseGit settings
8 rem (Start -> Programs -> TortoiseGit -> Settings), select "Diff Viewer",
9 rem click button "Advanced..." on the right tab and then add new record:
10 rem - Extension: .svg
11 rem - External program: <path to OCCT>\adm\svgdiff.bat %base %mine %bname %yname
12
13 rem Remove double quotes around arguments
14 set "f1=%1"
15 set "f2=%2"
16 set "f1=%f1:~1,-1%.png"
17 set "f2=%f2:~1,-1%.png"
18
19 rem Check if Inkscape and TortoiseGit are installed in default locations in 
20 rem ProgramFiles; if not, assume they still may be accessible by PATH
21 set "inkscape=%ProgramFiles%\Inkscape\inkscape.exe"
22 if not exist "%inkscape%" set inkscape=inkscape.exe
23 set "tgitidiff=%ProgramFiles%\TortoiseGit\bin\TortoiseGitIDiff.exe"
24 if not exist "%tgitidiff%" set tgitidiff=TortoiseGitIDiff.exe
25
26 rem Convert SVG to PNG using Inkscape
27 "%inkscape%" -e "%f1%" %1
28 "%inkscape%" -e "%f2%" %2
29
30 rem Call Tortoise differ
31 "%tgitidiff%" /left:"%f1%" /right:"%f2%" /lefttitle:%3 /righttitle:%4