diff -aurN 0001/src/unix-adapter/main.cc 0002/src/unix-adapter/main.cc --- 0001/src/unix-adapter/main.cc +++ 0002/src/unix-adapter/main.cc @@ -47,6 +47,7 @@ #include "OutputHandler.h" #include "Util.h" #include "WakeupFd.h" +#include "path_conv.h" #define CSI "\x1b[" @@ -154,7 +155,12 @@ char *tmp; #if defined(CYGWIN_VERSION_CYGWIN_CONV) && \ CYGWIN_VERSION_API_MINOR >= CYGWIN_VERSION_CYGWIN_CONV - // MSYS2 and versions of Cygwin released after 2009 or so use this API. +#if defined(__MSYS__) + size_t newSize = 256 * MAX_PATH; + tmp = new char[newSize + 1]; + convert(tmp, newSize, path.c_str()); +#else + // Versions of Cygwin released after 2009 or so use this API. // The original MSYS still lacks this API. ssize_t newSize = cygwin_conv_path(CCP_POSIX_TO_WIN_A | CCP_RELATIVE, path.c_str(), NULL, 0); @@ -163,6 +169,7 @@ ssize_t success = cygwin_conv_path(CCP_POSIX_TO_WIN_A | CCP_RELATIVE, path.c_str(), tmp, newSize + 1); assert(success == 0); +#endif #else // In the current Cygwin header file, this API is documented as deprecated // because it's restricted to paths of MAX_PATH length. In the CVS version @@ -173,10 +180,6 @@ tmp = new char[MAX_PATH + path.size()]; cygwin_conv_to_win32_path(path.c_str(), tmp); #endif - for (int i = 0; tmp[i] != '\0'; ++i) { - if (tmp[i] == '/') - tmp[i] = '\\'; - } std::string ret(tmp); delete [] tmp; return ret; diff -aurN 0001/src/unix-adapter/path_conv.cc 0002/src/unix-adapter/path_conv.cc --- 0001/src/unix-adapter/path_conv.cc +++ 0002/src/unix-adapter/path_conv.cc @@ -633,7 +633,6 @@ one_path[to-from] = '\0'; char win32_path1[PATH_MAX + 1]; ssize_t result = cygwin_conv_path(CCP_POSIX_TO_WIN_A|CCP_ABSOLUTE, one_path, win32_path1, PATH_MAX+1); - printf("called cygwin_conv_path(CCP_POSIX_TO_WIN_A,%s -> %s, in-size %d, result = %zd\n", one_path, win32_path1, PATH_MAX+1, result); if( result !=0 ) { copy_to_dst(one_path, NULL, dst, dstend); } else { diff -aurN 0001/src/unix-adapter/subdir.mk 0002/src/unix-adapter/subdir.mk --- 0001/src/unix-adapter/subdir.mk +++ 0002/src/unix-adapter/subdir.mk @@ -28,6 +28,7 @@ build/unix-adapter/unix-adapter/Util.o \ build/unix-adapter/unix-adapter/WakeupFd.o \ build/unix-adapter/unix-adapter/main.o \ + build/unix-adapter/unix-adapter/path_conv.o \ build/unix-adapter/shared/DebugClient.o \ build/unix-adapter/shared/WinptyAssert.o \ build/unix-adapter/shared/WinptyVersion.o