cmd: Fix tilda parameter expansion when arg is empty.

This commit is contained in:
Jason Edmeades 2013-06-02 21:29:58 +01:00 committed by Alexandre Julliard
parent dc4dd0cb97
commit 2b9649d9db
3 changed files with 9 additions and 5 deletions

View File

@ -514,11 +514,13 @@ void WCMD_HandleTildaModifiers(WCHAR **start, BOOL atExecute)
/* After this, we need full information on the file,
which is valid not to exist. */
if (!skipFileParsing) {
if (GetFullPathNameW(outputparam, MAX_PATH, fullfilename, NULL) == 0)
return;
exists = GetFileAttributesExW(fullfilename, GetFileExInfoStandard,
&fileInfo);
if (GetFullPathNameW(outputparam, MAX_PATH, fullfilename, NULL) == 0) {
exists = FALSE;
fullfilename[0] = 0x00;
} else {
exists = GetFileAttributesExW(fullfilename, GetFileExInfoStandard,
&fileInfo);
}
/* 2. Handle 'a' : Output attributes (File doesn't have to exist) */
if (memchrW(firstModifier, 'a', modifierLen) != NULL) {

View File

@ -363,6 +363,7 @@ for %%i in ("d e" f) do echo %%~dpi
for %%i in ("g h" i) do echo %%~sdi
for %%i in ("g h" i) do echo %%~dsi
for %%i in ("j k" l.eh) do echo '%%~xsi'
for %%i in ("") do echo '%%~i,%%~fi,%%~di,%%~pi,%%~ni,%%~xi,%%~si,%%~ai,%%~ti,%%~zi'
echo --- in parameters
for %%i in ("A B" C) do call :echoFun %%i

View File

@ -319,6 +319,7 @@ N
@drive@
''
'.eh'
',,,,,,,,,'
--- in parameters
"A B"
C