From 3243f69f217eb24f05631030858b15eaf1a0c4d6 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Wed, 4 Jun 2008 18:09:21 -0700 Subject: [PATCH] Use %AppData%\alsoft.ini for the config file in Windows --- Alc/alcConfig.c | 16 ++++++++++++++++ alsoftrc.sample | 1 + 2 files changed, 17 insertions(+) diff --git a/Alc/alcConfig.c b/Alc/alcConfig.c index de69ad87..d5f4fb5e 100644 --- a/Alc/alcConfig.c +++ b/Alc/alcConfig.c @@ -27,6 +27,11 @@ #include "alMain.h" +#ifdef _WIN32 +#define _WIN32_IE 0x400 +#include +#endif + typedef struct ConfigEntry { char *key; char *value; @@ -201,6 +206,17 @@ void ReadALConfig(void) cfgCount = 1; #ifdef _WIN32 + if(SHGetSpecialFolderPathA(NULL, buffer, CSIDL_APPDATA, FALSE) != FALSE) + { + int p = strlen(buffer); + snprintf(buffer+p, sizeof(buffer)-p, "\\alsoft.ini"); + f = fopen(buffer, "rt"); + if(f) + { + LoadConfigFromFile(f); + fclose(f); + } + } #else f = fopen("/etc/openal/alsoft.conf", "r"); if(!f) diff --git a/alsoftrc.sample b/alsoftrc.sample index 8eaa0f4f..06d32dc9 100644 --- a/alsoftrc.sample +++ b/alsoftrc.sample @@ -4,6 +4,7 @@ # specified. # The system-wide settings can be put in /etc/openal/alsoft.conf and user- # specific override settings in ~/.alsoftrc. +# For Windows, these settings should go into %AppData%\alsoft.ini # Option and block names are case-insenstive. The supplied values are only # hints and may not be honored (though generally it'll try to get as close as -- 2.11.4.GIT