OSDN Git Service

* win/tclWin32Dll.c (TclWinInit): Set native cwd to Cygwin's cwd.
authorcorinna <corinna>
Fri, 1 Dec 2006 20:35:55 +0000 (20:35 +0000)
committercorinna <corinna>
Fri, 1 Dec 2006 20:35:55 +0000 (20:35 +0000)
* win/tclWinFile.c (TclpObjChdir): Keep native and Cygwin's cwd
synched.

tcl/ChangeLog
tcl/win/tclWin32Dll.c
tcl/win/tclWinFile.c

index 1f9f65c..35336ee 100644 (file)
@@ -1,3 +1,9 @@
+2006-12-01  Corinna Vinschen  <corinna@vinschen.de>
+
+       * win/tclWin32Dll.c (TclWinInit): Set native cwd to Cygwin's cwd.
+       * win/tclWinFile.c (TclpObjChdir): Keep native and Cygwin's cwd
+       synched.
+
 2006-11-30  Christopher Faylor  <cgf@timesys.com>
 
        * cygwin/configure.in (LIB_AC_PROG_CC): Upgrade macro to accommodate
index e1a3cc1..ff2d0b2 100644 (file)
@@ -13,6 +13,9 @@
  */
 
 #include "tclWinInt.h"
+#ifdef __CYGWIN__
+#include <sys/cygwin.h>
+#endif
 
 /*
  * The following data structures are used when loading the thunking 
@@ -267,6 +270,14 @@ TclWinInit(hInst)
        panic("Win32s is not a supported platform");    
     }
 
+#ifdef __CYGWIN__
+    {
+      char cwd_posix[MAX_PATH], cwd_win32[MAX_PATH];
+      cygwin_conv_to_full_win32_path (getcwd (cwd_posix, MAX_PATH), cwd_win32);
+      SetCurrentDirectory (cwd_win32);
+    }
+#endif
+
     tclWinProcs = &asciiProcs;
 }
 \f
index 9495cae..4c018c6 100644 (file)
@@ -1340,14 +1340,16 @@ TclpObjChdir(pathPtr)
 
 
     nativePath = (CONST TCHAR *) Tcl_FSGetNativePath(pathPtr);
+    result = (*tclWinProcs->setCurrentDirectoryProc)(nativePath);
 #ifdef __CYGWIN__
     /* Cygwin chdir only groks POSIX path. */
-    path = Tcl_WinTCharToUtf(nativePath, -1, &ds);
-    cygwin_conv_to_posix_path(path, posixPath);
-    result = (chdir(posixPath) == 0 ? 1 : 0);
-    Tcl_DStringFree(&ds);
-#else /* __CYGWIN__ */
-    result = (*tclWinProcs->setCurrentDirectoryProc)(nativePath);
+    if (result)
+      {
+       path = Tcl_WinTCharToUtf(nativePath, -1, &ds);
+       cygwin_conv_to_posix_path(path, posixPath);
+       result = (chdir(posixPath) == 0 ? 1 : 0);
+       Tcl_DStringFree(&ds);
+      }
 #endif /* __CYGWIN__ */
 
     if (result == 0) {