Implement fluid_get_userconf() on windows (#425)

This commit is contained in:
Tom M 2018-09-09 22:34:35 +02:00 committed by GitHub
parent 64687c3a05
commit e4b8e2b44c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 8 deletions

View File

@ -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() - 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 - fluid_synth_remove_sfont() returns FLUID_OK or FLUID_FAILED
- introduce a separate data type for sequencer client IDs: #fluid_seq_id_t - introduce a separate data type for sequencer client IDs: #fluid_seq_id_t
- fluid_get_userconf() has been implemented for Windows
<strong>New Features and API additions:</strong> <strong>New Features and API additions:</strong>

View File

@ -623,10 +623,17 @@ fluid_source(fluid_cmd_handler_t *handler, const char *filename)
char * char *
fluid_get_userconf(char *buf, int len) fluid_get_userconf(char *buf, int len)
{ {
#if defined(WIN32) || defined(MACOS9) const char *home = NULL;
return NULL; const char *config_file;
#else #if defined(WIN32)
char *home = getenv("HOME"); home = getenv("USERPROFILE");
config_file = "\\fluidsynth.cfg";
#elif !defined(MACOS9)
home = getenv("HOME");
config_file = "/.fluidsynth";
#endif
if(home == NULL) if(home == NULL)
{ {
@ -634,11 +641,9 @@ fluid_get_userconf(char *buf, int len)
} }
else else
{ {
FLUID_SNPRINTF(buf, len, "%s/.fluidsynth", home); FLUID_SNPRINTF(buf, len, "%s%s", home, config_file);
return buf; return buf;
} }
#endif
} }
/** /**