From fa513886410a85c2229acfa558c5375e5fad278b Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Sat, 11 Jan 2025 01:14:23 +0900 Subject: [PATCH] Win32: Append `-p` option to `RMDIRS` `rmdirs.bat` may require this option explicitly to remove parent directories, in the future. --- win32/Makefile.sub | 4 ++-- win32/rmdirs.bat | 6 +++++- 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%