Skip to content

Commit

Permalink
Merge pull request #1893 from fwmechanic/win32-case-insensitive-fnm-cmp
Browse files Browse the repository at this point in the history
make file/dirnm comparison in relativeFilename case-insensitive for WIN32
  • Loading branch information
masatake committed Oct 8, 2018
2 parents 208e2c0 + 004231d commit 2888a6d
Showing 1 changed file with 13 additions and 1 deletion.
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

0 comments on commit 2888a6d

Please sign in to comment.