summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2025-01-11 01:14:23 +0900
committerNobuyoshi Nakada <nobu.nakada@gmail.com>2025-12-02 09:55:01 +0900
commitfa513886410a85c2229acfa558c5375e5fad278b (patch)
tree7b4249446492df70fc0f71fe5139573a1b30c132
parenta6c5d290abaa232a60c21fa2a48ac0228de8270b (diff)
Win32: Append `-p` option to `RMDIRS`
`rmdirs.bat` may require this option explicitly to remove parent directories, in the future.
-rw-r--r--win32/Makefile.sub4
-rwxr-xr-xwin32/rmdirs.bat6
2 files changed, 7 insertions, 3 deletions
diff --git a/win32/Makefile.sub b/win32/Makefile.sub
index 79fbdb30c4..737c8f6bd6 100644
--- a/win32/Makefile.sub
+++ b/win32/Makefile.sub
@@ -117,7 +117,7 @@ IFCHANGE = $(COMSPEC) /C $(srcdir:/=\)\win32\ifchange.bat
RM = $(COMSPEC) /C $(srcdir:/=\)\win32\rm.bat
RM1 = del
RMDIR = $(COMSPEC) /C $(srcdir:/=\)\win32\rmdirs.bat
-RMDIRS = $(COMSPEC) /C $(srcdir:/=\)\win32\rmdirs.bat
+RMDIRS = $(COMSPEC) /C $(srcdir:/=\)\win32\rmdirs.bat -p
RMALL = $(COMSPEC) /C $(srcdir:/=\)\win32\rm.bat -f -r
MAKEDIRS = $(COMSPEC) /E:ON /C $(srcdir:/=\)\win32\makedirs.bat
TOUCH = $(BASERUBY) -run -e touch --
@@ -968,7 +968,7 @@ s,@LN_S@,$(LN_S),;t t
s,@SET_MAKE@,MFLAGS = -$$(MAKEFLAGS),;t t
s,@RM@,$$(COMSPEC) /C $$(top_srcdir:/=\)\win32\rm.bat,;t t
s,@RMDIR@,$$(COMSPEC) /C $$(top_srcdir:/=\)\win32\rmdirs.bat,:t t
-s,@RMDIRS@,$$(COMSPEC) /C $$(top_srcdir:/=\)\win32\rmdirs.bat,;t t
+s,@RMDIRS@,$$(COMSPEC) /C $$(top_srcdir:/=\)\win32\rmdirs.bat -p,;t t
s,@RMALL@,$$(COMSPEC) /C $$(top_srcdir:/=\)\win32\rm.bat -f -r,:t t
s,@MAKEDIRS@,$$(COMSPEC) /E:ON /C $$(top_srcdir:/=\)\win32\makedirs.bat,;t t
s,@LIBOBJS@,$(LIBOBJS),;t t
diff --git a/win32/rmdirs.bat b/win32/rmdirs.bat
index c3d7b637b3..a8abebd383 100755
--- a/win32/rmdirs.bat
+++ b/win32/rmdirs.bat
@@ -1,6 +1,9 @@
@echo off
@setlocal EnableExtensions DisableDelayedExpansion || exit /b -1
-if "%1" == "-p" shift
+set parents=1
+:optloop
+if "%1" == "--debug" (shift & set PROMPT=$E[34m+$E[m$S & echo on & goto :optloop)
+if "%1" == "-p" (shift & (set parents=1) & goto :optloop)
:begin
if "%1" == "" goto :end
set dir=%1
@@ -12,6 +15,7 @@ if "%1" == "" goto :end
if "%dir%" == "." goto :begin
if "%dir%" == ".." goto :begin
rd "%dir%" 2> nul || goto :begin
+ if "%parents%" == "" goto :begin
:trim_sep
if not /%dir:~-1%/ == /\/ goto :trim_base
set dir=%dir:~0,-1%