Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make file/dirnm comparison in relativeFilename case-insensitive for WIN32 #1893

Merged
merged 1 commit into from
Oct 8, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion main/routines.c
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,18 @@ extern const char *getExecutablePath (void)
return ExecutableProgram;
}

/*
* compare file/dirname characters with platform-correct case sensitivity
*/
static bool fnmChEq (int c1, int c2)
{
#ifdef WIN32
return tolower( c1 ) == tolower( c2 ); /* case-insensitive */
#else
return c1 == c2 ; /* case- sensitive */
#endif
}

/*
* Memory allocation functions
*/
Expand Down Expand Up @@ -846,7 +858,7 @@ extern char* relativeFilename (const char *file, const char *dir)
absdir = absoluteFilename (file);
fp = absdir;
dp = dir;
while (*fp++ == *dp++)
while (fnmChEq (*fp++, *dp++))
continue;
fp--;
dp--; /* back to the first differing char */
Expand Down