Fix casepath chaos

This commit is contained in:
eray orçunus
2020-07-26 20:59:58 +03:00
parent ef7afe5f2f
commit c87b639a84
6 changed files with 150 additions and 119 deletions

View File

@ -255,15 +255,11 @@ CStream::CStream(char *filename, ALuint &source, ALuint (&buffers)[NUM_STREAMBUF
{
// Be case-insensitive on linux (from https://github.com/OneSadCookie/fcaseopen/)
#if !defined(_WIN32)
FILE *test = fopen(filename, "r");
if (!test) {
char *r = (char*)alloca(strlen(filename) + 2);
if (casepath(filename, r))
{
strcpy(m_aFilename, r);
}
char *real = casepath(filename);
if (real) {
strcpy(m_aFilename, real);
free(real);
} else {
fclose(test);
#else
{
#endif