cmd: del /a: test deleting readonly files, with fix.
This commit is contained in:
parent
65b27c9ecd
commit
ff1e7038b2
|
@ -712,9 +712,10 @@ BOOL WCMD_delete (WCHAR *command, BOOL expectDir) {
|
||||||
/* Only proceed if ok to */
|
/* Only proceed if ok to */
|
||||||
if (ok) {
|
if (ok) {
|
||||||
|
|
||||||
/* If file is read only, and /F supplied, delete it */
|
/* If file is read only, and /A:r or /F supplied, delete it */
|
||||||
if (fd.dwFileAttributes & FILE_ATTRIBUTE_READONLY &&
|
if (fd.dwFileAttributes & FILE_ATTRIBUTE_READONLY &&
|
||||||
strstrW (quals, parmF) != NULL) {
|
((wanted_attrs & FILE_ATTRIBUTE_READONLY) ||
|
||||||
|
strstrW (quals, parmF) != NULL)) {
|
||||||
SetFileAttributesW(fpath, fd.dwFileAttributes & ~FILE_ATTRIBUTE_READONLY);
|
SetFileAttributesW(fpath, fd.dwFileAttributes & ~FILE_ATTRIBUTE_READONLY);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -78,6 +78,22 @@ if /i not foo==FOO echo if /i seems to be broken
|
||||||
if /I foo==FOO echo if /I seems to work
|
if /I foo==FOO echo if /I seems to work
|
||||||
if /I not foo==FOO echo if /I seems to be broken
|
if /I not foo==FOO echo if /I seems to be broken
|
||||||
|
|
||||||
|
echo -----------Testing del /a-----------
|
||||||
|
del /f/q *.test > nul
|
||||||
|
echo r > r.test
|
||||||
|
attrib +r r.test
|
||||||
|
echo not-r > not-r.test
|
||||||
|
|
||||||
|
if not exist not-r.test echo not-r.test not found before delete, bad
|
||||||
|
del /a:-r *.test
|
||||||
|
if not exist not-r.test echo not-r.test not found after delete, good
|
||||||
|
|
||||||
|
if not exist r.test echo r.test not found before delete, bad
|
||||||
|
if exist r.test echo r.test found before delete, good
|
||||||
|
del /a:r *.test
|
||||||
|
if not exist r.test echo r.test not found after delete, good
|
||||||
|
if exist r.test echo r.test found after delete, bad
|
||||||
|
|
||||||
echo -----------Testing GOTO-----------
|
echo -----------Testing GOTO-----------
|
||||||
if a==a goto dest1
|
if a==a goto dest1
|
||||||
:dest1
|
:dest1
|
||||||
|
|
|
@ -78,6 +78,10 @@ Testing case sensitivity with and without /i option
|
||||||
if seems to default to case sensitivity
|
if seems to default to case sensitivity
|
||||||
if /i seems to work
|
if /i seems to work
|
||||||
if /I seems to work
|
if /I seems to work
|
||||||
|
-----------Testing del /a-----------
|
||||||
|
not-r.test not found after delete, good
|
||||||
|
r.test found before delete, good
|
||||||
|
r.test not found after delete, good
|
||||||
-----------Testing GOTO-----------
|
-----------Testing GOTO-----------
|
||||||
goto with no leading space worked
|
goto with no leading space worked
|
||||||
goto with a leading space worked
|
goto with a leading space worked
|
||||||
|
|
Loading…
Reference in New Issue