Jason Edmeades : cmd.exe: Support cd .. when saving current directory.

Alexandre Julliard julliard at winehq.org
Tue Mar 4 14:31:39 CST 2008


Module: wine
Branch: master
Commit: 4492334762a71d037edfab61cb40ad337723d974
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=4492334762a71d037edfab61cb40ad337723d974

Author: Jason Edmeades <jason.edmeades at googlemail.com>
Date:   Mon Mar  3 23:14:30 2008 +0000

cmd.exe: Support cd .. when saving current directory.

---

 programs/cmd/builtins.c |    3 +++
 programs/cmd/wcmdmain.c |    3 +++
 2 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/programs/cmd/builtins.c b/programs/cmd/builtins.c
index 8592090..17b385d 100644
--- a/programs/cmd/builtins.c
+++ b/programs/cmd/builtins.c
@@ -1865,6 +1865,9 @@ void WCMD_setshow_default (WCHAR *command) {
       return;
     } else {
 
+      /* Save away the actual new directory, to store as current location */
+      GetCurrentDirectoryW (sizeof(string)/sizeof(WCHAR), string);
+
       /* Restore old directory if drive letter would change, and
            CD x:\directory /D (or pushd c:\directory) not supplied */
       if ((strstrW(quals, parmD) == NULL) &&
diff --git a/programs/cmd/wcmdmain.c b/programs/cmd/wcmdmain.c
index 2261a28..4c482ee 100644
--- a/programs/cmd/wcmdmain.c
+++ b/programs/cmd/wcmdmain.c
@@ -419,6 +419,7 @@ int wmain (int argc, WCHAR *argvW[])
     static const WCHAR fmt[] = {'=','%','c',':','\0'};
     wsprintf(envvar, fmt, string[0]);
     SetEnvironmentVariable(envvar, string);
+    WINE_TRACE("Set %s to %s\n", wine_dbgstr_w(envvar), wine_dbgstr_w(string));
   }
 
   if (opt_k) {
@@ -643,7 +644,9 @@ void WCMD_execute (WCHAR *command, WCHAR *redirects,
       if (GetEnvironmentVariable(envvar, dir, MAX_PATH) == 0) {
         static const WCHAR fmt[] = {'%','s','\\','\0'};
         wsprintf(cmd, fmt, cmd);
+        WINE_TRACE("No special directory settings, using dir of %s\n", wine_dbgstr_w(cmd));
       }
+      WINE_TRACE("Got directory %s as %s\n", wine_dbgstr_w(envvar), wine_dbgstr_w(cmd));
       status = SetCurrentDirectory (cmd);
       if (!status) WCMD_print_error ();
       HeapFree( GetProcessHeap(), 0, cmd );




More information about the wine-cvs mailing list