From e4b8e2b44cbf5257274606bbb5d32d6f5e5b3096 Mon Sep 17 00:00:00 2001 From: Tom M Date: Sun, 9 Sep 2018 22:34:35 +0200 Subject: [PATCH] Implement fluid_get_userconf() on windows (#425) --- doc/fluidsynth-v20-devdoc.txt | 1 + src/bindings/fluid_cmd.c | 21 +++++++++++++-------- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/doc/fluidsynth-v20-devdoc.txt b/doc/fluidsynth-v20-devdoc.txt index 9bff19d1..63fcb6c7 100644 --- a/doc/fluidsynth-v20-devdoc.txt +++ b/doc/fluidsynth-v20-devdoc.txt @@ -81,6 +81,7 @@ FluidSynths major version was bumped. The API was reworked, deprecated functions - rename chorus getters to match naming conventions: fluid_synth_get_chorus_speed() and fluid_synth_get_chorus_depth() - fluid_synth_remove_sfont() returns FLUID_OK or FLUID_FAILED - introduce a separate data type for sequencer client IDs: #fluid_seq_id_t +- fluid_get_userconf() has been implemented for Windows New Features and API additions: diff --git a/src/bindings/fluid_cmd.c b/src/bindings/fluid_cmd.c index 97780ac9..d953c0fc 100644 --- a/src/bindings/fluid_cmd.c +++ b/src/bindings/fluid_cmd.c @@ -623,22 +623,27 @@ fluid_source(fluid_cmd_handler_t *handler, const char *filename) char * fluid_get_userconf(char *buf, int len) { -#if defined(WIN32) || defined(MACOS9) - return NULL; -#else - char *home = getenv("HOME"); - + const char *home = NULL; + const char *config_file; +#if defined(WIN32) + home = getenv("USERPROFILE"); + config_file = "\\fluidsynth.cfg"; + +#elif !defined(MACOS9) + home = getenv("HOME"); + config_file = "/.fluidsynth"; + +#endif + if(home == NULL) { return NULL; } else { - FLUID_SNPRINTF(buf, len, "%s/.fluidsynth", home); + FLUID_SNPRINTF(buf, len, "%s%s", home, config_file); return buf; } - -#endif } /**