cmd: Add @shortpath@ keyword, replaced by expanded path with short names.
This commit is contained in:
parent
68e7fcda59
commit
c85be8aecc
|
@ -28,6 +28,8 @@ static char drive[2];
|
|||
static const DWORD drive_len = sizeof(drive)/sizeof(drive[0]);
|
||||
static char path[MAX_PATH];
|
||||
static DWORD path_len;
|
||||
static char shortpath[MAX_PATH];
|
||||
static DWORD shortpath_len;
|
||||
|
||||
/* Convert to DOS line endings, and substitute escaped whitespace chars with real ones */
|
||||
static const char* convert_input_data(const char *data, DWORD size, DWORD *new_size)
|
||||
|
@ -160,6 +162,7 @@ static const char *compare_line(const char *out_line, const char *out_end, const
|
|||
static const char pwd_cmd[] = {'@','p','w','d','@'};
|
||||
static const char drive_cmd[] = {'@','d','r','i','v','e','@'};
|
||||
static const char path_cmd[] = {'@','p','a','t','h','@'};
|
||||
static const char shortpath_cmd[] = {'@','s','h','o','r','t','p','a','t','h','@'};
|
||||
static const char space_cmd[] = {'@','s','p','a','c','e','@'};
|
||||
static const char tab_cmd[] = {'@','t','a','b','@'};
|
||||
static const char or_broken_cmd[] = {'@','o','r','_','b','r','o','k','e','n','@'};
|
||||
|
@ -199,6 +202,17 @@ static const char *compare_line(const char *out_line, const char *out_end, const
|
|||
out_ptr += path_len;
|
||||
continue;
|
||||
}
|
||||
} else if(exp_ptr+sizeof(shortpath_cmd) <= exp_end
|
||||
&& !memcmp(exp_ptr, shortpath_cmd, sizeof(shortpath_cmd))) {
|
||||
exp_ptr += sizeof(shortpath_cmd);
|
||||
if(out_end-out_ptr < shortpath_len
|
||||
|| (CompareStringA(LOCALE_SYSTEM_DEFAULT, NORM_IGNORECASE,
|
||||
out_ptr, shortpath_len, shortpath, shortpath_len) != CSTR_EQUAL)) {
|
||||
err = out_ptr;
|
||||
}else {
|
||||
out_ptr += shortpath_len;
|
||||
continue;
|
||||
}
|
||||
}else if(exp_ptr+sizeof(space_cmd) <= exp_end
|
||||
&& !memcmp(exp_ptr, space_cmd, sizeof(space_cmd))) {
|
||||
exp_ptr += sizeof(space_cmd);
|
||||
|
@ -424,6 +438,8 @@ START_TEST(batch)
|
|||
memcpy(path, workdir + drive_len, (workdir_len - drive_len) * sizeof(drive[0]));
|
||||
path[workdir_len - drive_len] = '\\';
|
||||
path_len = workdir_len - drive_len + 1;
|
||||
shortpath_len = GetShortPathNameA(path, shortpath,
|
||||
sizeof(shortpath)/sizeof(shortpath[0]));
|
||||
|
||||
argc = winetest_get_mainargs(&argv);
|
||||
if(argc > 2)
|
||||
|
|
Loading…
Reference in New Issue