From 0ae64681f5d0dbdeb28ebad6116eace9d12976e9 Mon Sep 17 00:00:00 2001 From: corinna Date: Fri, 1 Dec 2006 20:35:55 +0000 Subject: [PATCH] * win/tclWin32Dll.c (TclWinInit): Set native cwd to Cygwin's cwd. * win/tclWinFile.c (TclpObjChdir): Keep native and Cygwin's cwd synched. --- tcl/ChangeLog | 6 ++++++ tcl/win/tclWin32Dll.c | 11 +++++++++++ tcl/win/tclWinFile.c | 14 ++++++++------ 3 files changed, 25 insertions(+), 6 deletions(-) diff --git a/tcl/ChangeLog b/tcl/ChangeLog index 1f9f65cfef..35336eea5f 100644 --- a/tcl/ChangeLog +++ b/tcl/ChangeLog @@ -1,3 +1,9 @@ +2006-12-01 Corinna Vinschen + + * 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 * cygwin/configure.in (LIB_AC_PROG_CC): Upgrade macro to accommodate diff --git a/tcl/win/tclWin32Dll.c b/tcl/win/tclWin32Dll.c index e1a3cc1dc0..ff2d0b2f4d 100644 --- a/tcl/win/tclWin32Dll.c +++ b/tcl/win/tclWin32Dll.c @@ -13,6 +13,9 @@ */ #include "tclWinInt.h" +#ifdef __CYGWIN__ +#include +#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; } diff --git a/tcl/win/tclWinFile.c b/tcl/win/tclWinFile.c index 9495cae659..4c018c632a 100644 --- a/tcl/win/tclWinFile.c +++ b/tcl/win/tclWinFile.c @@ -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) { -- 2.11.0