32 lines
1.4 KiB
Diff
32 lines
1.4 KiB
Diff
--- Python-3.2.3-orig/Modules/getpath.c 2012-04-11 02:54:07.000000000 -0400
|
|
+++ Python-3.2.3/Modules/getpath.c 2012-06-14 13:33:30.179375000 -0400
|
|
@@ -491,6 +491,28 @@
|
|
break;
|
|
}
|
|
|
|
+#ifdef __CYGWIN__
|
|
+ /*
|
|
+ * Cygwin automatically removes the ".exe" extension from argv[0]
|
|
+ * to make programs feel like they are in a more Unix-like
|
|
+ * environment. Unfortunately, this can make it problemmatic for
|
|
+ * Cygwin to distinguish between a directory and an executable with
|
|
+ * the same name excluding the ".exe" extension. For example, the
|
|
+ * Cygwin Python build directory has a "Python" directory and a
|
|
+ * "python.exe" executable. This causes isxfile() to erroneously
|
|
+ * return false. If isdir() returns true and there is enough space
|
|
+ * to append the ".exe" extension, then we try again with the
|
|
+ * extension appended.
|
|
+ */
|
|
+#define EXE L".exe"
|
|
+ if (isdir(program_full_path) && wcslen(program_full_path) + wcslen(EXE) <= MAXPATHLEN)
|
|
+ {
|
|
+ wcscat(program_full_path, EXE);
|
|
+ if (isxfile(program_full_path))
|
|
+ break;
|
|
+ }
|
|
+#endif /* __CYGWIN__ */
|
|
+
|
|
if (!delim) {
|
|
program_full_path[0] = L'\0';
|
|
break;
|