summaryrefslogtreecommitdiff
path: root/win32/ifchange.bat
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-10-16 14:39:53 (GMT)
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-10-16 14:39:53 (GMT)
commitd7144025fd8ddec68df388929179769cf8b37d72 (patch)
tree166082440d8722d9412a295ed0645309fe4f23cf /win32/ifchange.bat
parent8565a1b5020aadb3bb3dc7d50cc862928fd2322d (diff)
ifchange.bat: --keep option
* win32/ifchange.bat: add --keep option as well as tool/ifchange. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43309 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'win32/ifchange.bat')
-rwxr-xr-xwin32/ifchange.bat10
1 files changed, 10 insertions, 0 deletions
diff --git a/win32/ifchange.bat b/win32/ifchange.bat
index 24e4987..1444d1b 100755
--- a/win32/ifchange.bat
+++ b/win32/ifchange.bat
@@ -2,6 +2,7 @@
:: usage: ifchange target temporary
set timestamp=
+set keepsuffix=
:optloop
for %%I in (%1) do set opt=%%~I
if "%opt%" == "--timestamp" (
@@ -12,6 +13,14 @@ if "%opt%" == "--timestamp" (
set timestamp=%opt:~12%
shift
goto :optloop
+) else if "%opt%" == "--keep" (
+ set keepsuffix=.old
+ shift
+ goto :optloop
+) else if "%opt:~0,7%" == "--keep=" (
+ set keepsuffix=%opt:~7%
+ shift
+ goto :optloop
)
if "%opt%" == "" goto :end
@@ -51,6 +60,7 @@ echo assuming %1 should be changed.
echo %1 updated.
:: if exist %1 del %1
dir /b %2
+if "%keepsuffix%" != "" %1 %1%keepsuffix%
copy %2 %1
del %2
goto :end