Ticket #8275: win_cfg_progdir.diff

File win_cfg_progdir.diff, 875 bytes (added by SF/quietust, 21 years ago)

Search for SCUMMVM.INI in program directory

  • main.cpp

     
    165165#else
    166166        char scummhome[256];
    167167        #if defined (WIN32) && !defined(_WIN32_WCE)
    168                 GetWindowsDirectory(scummhome, 256);
    169                 strcat(scummhome, "\\");
     168                // Quietust - try looking for INI file in program directory first
     169                GetModuleFileName(NULL, scummhome, 256);
     170                int i = strlen(scummhome) - 1;
     171                while (scummhome[i] != '\\')
     172                        scummhome[i--] = 0;
    170173                strcat(scummhome, DEFAULT_CONFIG_FILE);
     174                if (GetFileAttributes(scummhome) == 0xFFFFFFFF) {
     175                        // does not exist in program directory, default to Windows directory
     176                        GetWindowsDirectory(scummhome, 256);
     177                        strcat(scummhome, "\\");
     178                        strcat(scummhome, DEFAULT_CONFIG_FILE);
     179                }
    171180        #elif defined(__PALM_OS__)
    172181                strcpy(scummhome,"/PALM/Programs/ScummVM/");
    173182                strcat(scummhome, DEFAULT_CONFIG_FILE);