fix drive letter case in Compute_relative_path()

This commit is contained in:
Thomas Bernard 2019-02-04 21:27:00 +01:00
parent 67020cd146
commit d131b48274
No known key found for this signature in database
GPG Key ID: 0FF11B67A5C0863C

View File

@ -942,8 +942,13 @@ const char * Calculate_relative_path(const char * ref_path, const char * path)
real_ref_path[MAX_PATH_CHARACTERS-1] = '\0';
}
#if defined(WIN32) || defined(__MINT__)
if ((real_ref_path[1] == ':') && (real_ref_path[0] | 32) != (path[0] | 32))
return NULL; // path on different volumes, not possible
if (real_ref_path[1] == ':' && path[1] == ':')
{
// use same case for drive letter
real_ref_path[0] = (real_ref_path[0] & ~32) | (path[0] & 32);
if (real_ref_path[0] != path[0])
return NULL; // path on different volumes, not possible
}
#endif
// look for common path parts
for (i = 0; real_ref_path[i] == path[i] && path[i] != '\0'; i++)