summaryrefslogtreecommitdiffstats
path: root/win/tclWinFile.c
diff options
context:
space:
mode:
authorhobbs <hobbs>2003-07-17 00:20:41 (GMT)
committerhobbs <hobbs>2003-07-17 00:20:41 (GMT)
commita626e7cb3acdd464d7121fc8a401eda7cbae9e92 (patch)
treeb2daa3910127e8c7bde6c38b6b76099bcf20ab8a /win/tclWinFile.c
parent7babac4bf486dcf01e87c9283ef4adf85b7e2cef (diff)
downloadtcl-a626e7cb3acdd464d7121fc8a401eda7cbae9e92.zip
tcl-a626e7cb3acdd464d7121fc8a401eda7cbae9e92.tar.gz
tcl-a626e7cb3acdd464d7121fc8a401eda7cbae9e92.tar.bz2
2003-07-16 Mumit Khan <khan@nanotech.wisc.edu>
* generic/tclPathObj.c (SetFsPathFromAny): Add Cygwin specific code to convert POSIX filename to native format. * generic/tclFileName.c (Tcl_TranslateFileName): And remove from here. (TclDoGlob): Adjust for cygwin and append / for dirs instead of \ * win/tclWinFile.c (TclpObjChdir): Use chdir on Cygwin. [Patch 679315]
Diffstat (limited to 'win/tclWinFile.c')
-rw-r--r--win/tclWinFile.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/win/tclWinFile.c b/win/tclWinFile.c
index badf819..bf5fa07 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.51 2003/06/23 10:14:02 vincentdarley Exp $
+ * RCS: @(#) $Id: tclWinFile.c,v 1.52 2003/07/17 00:20:41 hobbs Exp $
*/
//#define _WIN32_WINNT 0x0500
@@ -1422,9 +1422,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());