More fiddling w/ the new-fangled Mac import code.
This commit is contained in:
parent
8a18e99008
commit
dbe6ebbeff
|
@ -1111,16 +1111,19 @@ case_ok(char *buf, int len, int namelen, char *name)
|
||||||
#elif defined(__MACH__) && defined(__APPLE__)
|
#elif defined(__MACH__) && defined(__APPLE__)
|
||||||
DIR *dirp;
|
DIR *dirp;
|
||||||
struct dirent *dp;
|
struct dirent *dp;
|
||||||
char pathname[MAX_PATH + 1];
|
char pathname[MAXPATHLEN + 1];
|
||||||
const int pathlen = len - namelen - 1; /* don't want trailing SEP */
|
const int pathlen = len - namelen - 1; /* don't want trailing SEP */
|
||||||
|
|
||||||
|
if (getenv("PYTHONCASEOK") != NULL)
|
||||||
|
return 1;
|
||||||
|
|
||||||
/* Copy the path component into pathname; substitute "." if empty */
|
/* Copy the path component into pathname; substitute "." if empty */
|
||||||
if (pathlen <= 0) {
|
if (pathlen <= 0) {
|
||||||
pathname[0] = '.';
|
pathname[0] = '.';
|
||||||
pathname[1] = '\0';
|
pathname[1] = '\0';
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
assert(pathlen <= MAX_PATH);
|
assert(pathlen <= MAXPATHLEN);
|
||||||
memcpy(pathname, buf, pathlen);
|
memcpy(pathname, buf, pathlen);
|
||||||
pathname[pathlen] = '\0';
|
pathname[pathlen] = '\0';
|
||||||
}
|
}
|
||||||
|
@ -1128,18 +1131,19 @@ case_ok(char *buf, int len, int namelen, char *name)
|
||||||
dirp = opendir(pathname);
|
dirp = opendir(pathname);
|
||||||
if (dirp) {
|
if (dirp) {
|
||||||
while ((dp = readdir(dirp)) != NULL) {
|
while ((dp = readdir(dirp)) != NULL) {
|
||||||
|
const int thislen =
|
||||||
#ifdef _DIRENT_HAVE_D_NAMELEN
|
#ifdef _DIRENT_HAVE_D_NAMELEN
|
||||||
const int thislen = dp->d_namlen;
|
dp->d_namlen;
|
||||||
#else
|
#else
|
||||||
const int thislen = strlen(dp->d_name);
|
strlen(dp->d_name);
|
||||||
#endif
|
#endif
|
||||||
if (thislen == namelen && !strcmp(dp->d_name, name)) {
|
if (thislen == namelen && !strcmp(dp->d_name, name)) {
|
||||||
(void)closedir(dirp);
|
(void)closedir(dirp);
|
||||||
return 1; /* Found */
|
return 1; /* Found */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
(void)closedir(dirp);
|
(void)closedir(dirp);
|
||||||
|
}
|
||||||
return 0 ; /* Not found */
|
return 0 ; /* Not found */
|
||||||
|
|
||||||
/* assuming it's a case-sensitive filesystem, so there's nothing to do! */
|
/* assuming it's a case-sensitive filesystem, so there's nothing to do! */
|
||||||
|
|
Loading…
Reference in New Issue