Win32: Append -p option to RMDIRS

`rmdirs.bat` may require this option explicitly to remove parent
directories, in the future.
This commit is contained in:
Nobuyoshi Nakada 2025-01-11 01:14:23 +09:00 committed by Nobuyoshi Nakada
parent a6c5d290ab
commit fa51388641
Notes: git 2025-12-02 00:56:05 +00:00
2 changed files with 7 additions and 3 deletions

View File

@ -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

View File

@ -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%