cmd/tests: Correctly determine script path for root directories.

This commit is contained in:
Frédéric Delanoy 2014-03-11 00:16:27 +01:00 committed by Alexandre Julliard
parent 90f1e180e1
commit f80dd2469f
3 changed files with 18 additions and 2 deletions

View File

@ -459,8 +459,14 @@ START_TEST(batch)
drive[0] = workdir[0]; drive[0] = workdir[0];
drive[1] = workdir[1]; /* Should be ':' */ drive[1] = workdir[1]; /* Should be ':' */
memcpy(path, workdir + drive_len, (workdir_len - drive_len) * sizeof(drive[0])); memcpy(path, workdir + drive_len, (workdir_len - drive_len) * sizeof(drive[0]));
path[workdir_len - drive_len] = '\\';
path_len = workdir_len - drive_len + 1; /* Only add trailing backslash to 'path' for non-root directory */
if (workdir_len - drive_len > 1) {
path[workdir_len - drive_len] = '\\';
path_len = workdir_len - drive_len + 1;
} else {
path_len = 1; /* \ */
}
shortpath_len = GetShortPathNameA(path, shortpath, shortpath_len = GetShortPathNameA(path, shortpath,
sizeof(shortpath)/sizeof(shortpath[0])); sizeof(shortpath)/sizeof(shortpath[0]));

View File

@ -308,6 +308,13 @@ set WINE_FOO=
echo ------------ Testing variable expansion ------------ echo ------------ Testing variable expansion ------------
call :setError 0 call :setError 0
echo ~p0 should be path containing batch file
echo %~p0
mkdir dummydir
cd dummydir
echo %~p0
cd ..
rmdir dummydir
echo ~dp0 should be directory containing batch file echo ~dp0 should be directory containing batch file
echo %~dp0 echo %~dp0
mkdir dummydir mkdir dummydir

View File

@ -259,6 +259,9 @@ foo
'jim' 'jim'
'apple"banana"grape' 'apple"banana"grape'
------------ Testing variable expansion ------------ ------------ Testing variable expansion ------------
~p0 should be path containing batch file
@path@
@path@
~dp0 should be directory containing batch file ~dp0 should be directory containing batch file
@pwd@\ @pwd@\
@pwd@\ @pwd@\