diff options
Diffstat (limited to 'win')
-rw-r--r-- | win/tclWinFile.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/win/tclWinFile.c b/win/tclWinFile.c index 96ebbb2..f1f1ffa 100644 --- a/win/tclWinFile.c +++ b/win/tclWinFile.c @@ -11,7 +11,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclWinFile.c,v 1.44.2.4 2003/05/16 01:43:01 hobbs Exp $ + * RCS: @(#) $Id: tclWinFile.c,v 1.44.2.5 2003/07/17 00:16:04 hobbs Exp $ */ //#define _WIN32_WINNT 0x0500 @@ -1395,9 +1395,24 @@ TclpObjChdir(pathPtr) { int result; CONST TCHAR *nativePath; +#ifdef __CYGWIN__ + extern int cygwin_conv_to_posix_path + _ANSI_ARGS_((CONST char *, char *)); + char posixPath[MAX_PATH+1]; + CONST char *path; + Tcl_DString ds; +#endif /* __CYGWIN__ */ nativePath = (CONST TCHAR *) Tcl_FSGetNativePath(pathPtr); +#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); +#endif /* __CYGWIN__ */ if (result == 0) { TclWinConvertError(GetLastError()); |