cmd.exe: Support unquoted directories in CD command.

This commit is contained in:
Jason Edmeades 2007-03-08 00:42:33 +00:00 committed by Alexandre Julliard
parent b9265bc3a9
commit eb6d084fd6
3 changed files with 18 additions and 5 deletions

View File

@ -1046,18 +1046,31 @@ void WCMD_setshow_attrib (void) {
* Set/Show the current default directory
*/
void WCMD_setshow_default (void) {
void WCMD_setshow_default (char *command) {
BOOL status;
char string[1024];
char *pos;
if (strlen(param1) == 0) {
WINE_TRACE("Request change to directory '%s'\n", command);
if (strlen(command) == 0) {
GetCurrentDirectory (sizeof(string), string);
strcat (string, "\n");
WCMD_output (string);
}
else {
status = SetCurrentDirectory (param1);
/* Remove any double quotes, which may be in the
middle, eg. cd "C:\Program Files"\Microsoft is ok */
pos = string;
while (*command) {
if (*command != '"') *pos++ = *command;
command++;
}
*pos = 0x00;
/* Change to that directory */
WINE_TRACE("Really changing to directory '%s'\n", string);
status = SetCurrentDirectory (string);
if (!status) {
WCMD_print_error ();
return;

View File

@ -63,7 +63,7 @@ void WCMD_run_program (char *command, int called);
void WCMD_setlocal (const char *command);
void WCMD_setshow_attrib (void);
void WCMD_setshow_date (void);
void WCMD_setshow_default (void);
void WCMD_setshow_default (char *command);
void WCMD_setshow_env (char *command);
void WCMD_setshow_path (char *command);
void WCMD_setshow_prompt (void);

View File

@ -543,7 +543,7 @@ void WCMD_process_command (char *command)
break;
case WCMD_CD:
case WCMD_CHDIR:
WCMD_setshow_default ();
WCMD_setshow_default (p);
break;
case WCMD_CLS:
WCMD_clear_screen ();