From 26b376ba323cb421199396886cc0a1a9eb91361a Mon Sep 17 00:00:00 2001 From: Mikhail Titov Date: Fri, 13 May 2016 18:50:12 -0500 Subject: [PATCH 1/2] Support relative path for tmpdirprefix --- git-latexdiff | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/git-latexdiff b/git-latexdiff index e1e2472..e43656a 100755 --- a/git-latexdiff +++ b/git-latexdiff @@ -116,7 +116,8 @@ Options: -o , --output copy resulting PDF into (usually ending with .pdf) Implies "--cleanup all" - --tmpdirprefix where temporary directory will be created (default: /tmp) + --tmpdirprefix where temporary directory will be created (default: /tmp). + Relative path will use repository root as a base --verbose, -v give more verbose output --quiet redirect output from subprocesses to log files --prepare run before latexdiff (e.g. run make to generate @@ -501,6 +502,11 @@ tmpdir=$tmpdir_prefix/git-latexdiff.$$ mkdir "$tmpdir" || die "Cannot create temporary directory." cd "$tmpdir" || die "Cannot cd to $tmpdir" +if test $(uname -o) = "Msys"; then + tmpdir=$(pwd -W) +else + tmpdir=$(pwd) +fi mkdir old new || die "Cannot create old and new directories." @@ -697,6 +703,8 @@ elif [ -f "$pdffile" ]; then pdffile="$new_pdffile" fi +# Change directory so nothing will keep us from cleaning +cd "$initial_dir" if test "$view" = 1 || test "$view" = maybe && test -z "$output" ; then "$PDFVIEWER" "$pdffile" @@ -705,8 +713,6 @@ fi case "$cleanup" in "all") verbose "Cleaning-up result" - cd .. - cd .. rm -fr "$tmpdir" verbose_done ;; From 28f25713e86c9111e7722c6aea73ded7efd64b5f Mon Sep 17 00:00:00 2001 From: Mikhail Titov Date: Sat, 14 May 2016 15:00:08 -0500 Subject: [PATCH 2/2] Simple install script for MS Windows --- windows_install.cmd | 47 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 windows_install.cmd diff --git a/windows_install.cmd b/windows_install.cmd new file mode 100644 index 0000000..dc0ba71 --- /dev/null +++ b/windows_install.cmd @@ -0,0 +1,47 @@ +::::::::::::::::::::::::::::::::::::::::: +:: Automatically check & get admin rights +:: Based on http://stackoverflow.com/a/12264592/673826 +::::::::::::::::::::::::::::::::::::::::: +@echo off +CLS +ECHO. +ECHO ============================= +ECHO Running Admin shell +ECHO ============================= + +:checkPrivileges +NET FILE 1>NUL 2>NUL +if '%errorlevel%' == '0' ( goto gotPrivileges ) else ( goto getPrivileges ) + +:getPrivileges +if '%1'=='ELEV' (echo ELEV & shift /1 & goto gotPrivileges) +ECHO. +ECHO ************************************** +ECHO Invoking UAC for Privilege Escalation +ECHO ************************************** + +setlocal DisableDelayedExpansion +set "batchPath=%~0" +setlocal EnableDelayedExpansion +ECHO Set UAC = CreateObject^("Shell.Application"^) > "%temp%\OEgetPrivileges.vbs" +ECHO args = "ELEV " >> "%temp%\OEgetPrivileges.vbs" +ECHO For Each strArg in WScript.Arguments >> "%temp%\OEgetPrivileges.vbs" +ECHO args = args ^& strArg ^& " " >> "%temp%\OEgetPrivileges.vbs" +ECHO Next >> "%temp%\OEgetPrivileges.vbs" +ECHO UAC.ShellExecute "!batchPath!", args, "", "runas", 1 >> "%temp%\OEgetPrivileges.vbs" +"%SystemRoot%\System32\WScript.exe" "%temp%\OEgetPrivileges.vbs" %* +exit /B + +:gotPrivileges +if '%1'=='ELEV' shift /1 +setlocal & pushd . +cd /d %~dp0 + +:::::::::::::::::::::::::::: +::START +:::::::::::::::::::::::::::: + +rem Run me as Administrator +set SCRIPT=git-latexdiff +for /f "delims=" %%i in ('git --exec-path') do copy /Y %~dp0\%SCRIPT% "%%i\%SCRIPT%" +pause 0