From a5858ff5864d67e556b813ae510630772c00d32b Mon Sep 17 00:00:00 2001 From: Christophe Grenier Date: Wed, 14 May 2008 21:26:03 +0200 Subject: [PATCH] Fix filename_to_directory() for cygwin --- src/intrf.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/intrf.c b/src/intrf.c index c1b2bf40..219cf461 100644 --- a/src/intrf.c +++ b/src/intrf.c @@ -1154,18 +1154,19 @@ static char *filename_to_directory(const char *filename) #ifdef HAVE_GETCWD if(res!=NULL && strcmp(res,".")==0 && getcwd(buf, sizeof(buf)-1)!=NULL) { -#ifdef __CYGWIN__ - char beautifull_dst_directory[2048]; buf[sizeof(buf)-1]='\0'; - cygwin_conv_to_win32_path(buf, beautifull_dst_directory); - return strdup(beautifull_dst_directory); -#else - buf[sizeof(buf)-1]='\0'; - return strdup(buf); -#endif + res=buf; } #endif +#ifdef __CYGWIN__ + { + char beautifull_dst_directory[2048]; + cygwin_conv_to_win32_path(res, beautifull_dst_directory); + return strdup(beautifull_dst_directory); + } +#else return strdup(res); +#endif } int start_ncurses(const char *prog_name, const char *real_prog_name)