Fixed bug #517
authorSam Lantinga <slouken@libsdl.org>
Sat, 03 Oct 2009 09:50:42 +0000
changeset 41667aaecd0610d
parent 415 494bc6858d1f
child 417 b170d2ceb445
Fixed bug #517

Sam Lantinga - Sat Oct 3 02:49:41 PDT 2009
* Added TIMIDITY_CFG environment variable to fully locate timidity.cfg
CHANGES
timidity/config.h
timidity/timidity.c
     1.1 --- a/CHANGES	Sat Oct 03 09:29:50 2009 +0000
     1.2 +++ b/CHANGES	Sat Oct 03 09:50:42 2009 +0000
     1.3 @@ -1,4 +1,6 @@
     1.4  1.2.9:
     1.5 +Sam Lantinga - Sat Oct  3 02:49:41 PDT 2009
     1.6 + * Added TIMIDITY_CFG environment variable to fully locate timidity.cfg
     1.7  O.Sezer - 2009-10-02 08:41:50 PDT 
     1.8   * Fixed memory corruption in music initialization
     1.9  Sam Lantinga - Sat Oct 3 07:53:24 2009 UTC
     2.1 --- a/timidity/config.h	Sat Oct 03 09:29:50 2009 +0000
     2.2 +++ b/timidity/config.h	Sat Oct 03 09:50:42 2009 +0000
     2.3 @@ -174,7 +174,7 @@
     2.4  #define CONFIG_FILE_ETC_TIMIDITY "/etc/timidity/timidity.cfg"
     2.5  
     2.6  #if defined(__WIN32__) || defined(__OS2__)
     2.7 -#define DEFAULT_PATH	"\\TIMIDITY"
     2.8 +#define DEFAULT_PATH	"C:\\TIMIDITY"
     2.9  #else
    2.10  #define DEFAULT_PATH	"/usr/local/lib/timidity"
    2.11  #endif
     3.1 --- a/timidity/timidity.c	Sat Oct 03 09:29:50 2009 +0000
     3.2 +++ b/timidity/timidity.c	Sat Oct 03 09:50:42 2009 +0000
     3.3 @@ -294,10 +294,13 @@
     3.4  
     3.5  int Timidity_Init(int rate, int format, int channels, int samples)
     3.6  {
     3.7 -  if (read_config_file(CONFIG_FILE)<0) {
     3.8 -    if (read_config_file(CONFIG_FILE_ETC)<0) {
     3.9 -      if (read_config_file(CONFIG_FILE_ETC_TIMIDITY)<0) {
    3.10 -        return(-1);
    3.11 +  const char *env = getenv("TIMIDITY_CFG");
    3.12 +  if (!env || read_config_file(env)<0) {
    3.13 +    if (read_config_file(CONFIG_FILE)<0) {
    3.14 +      if (read_config_file(CONFIG_FILE_ETC)<0) {
    3.15 +        if (read_config_file(CONFIG_FILE_ETC_TIMIDITY)<0) {
    3.16 +          return(-1);
    3.17 +        }
    3.18        }
    3.19      }
    3.20    }